{"action":"created","issue":{"url":"https://api.github.com/repos/PuerkitoBio/goquery/issues/104","repository_url":"https://api.github.com/repos/PuerkitoBio/goquery","labels_url":"https://api.github.com/repos/PuerkitoBio/goquery/issues/104/labels{/name}","comments_url":"https://api.github.com/repos/PuerkitoBio/goquery/issues/104/comments","events_url":"https://api.github.com/repos/PuerkitoBio/goquery/issues/104/events","html_url":"https://github.com/PuerkitoBio/goquery/issues/104","id":148512841,"number":104,"title":"Extracting text from Title tag returns html tags","user":{"login":"kristen1980","id":6835691,"avatar_url":"https://avatars.githubusercontent.com/u/6835691?v=3","gravatar_id":"","url":"https://api.github.com/users/kristen1980","html_url":"https://github.com/kristen1980","followers_url":"https://api.github.com/users/kristen1980/followers","following_url":"https://api.github.com/users/kristen1980/following{/other_user}","gists_url":"https://api.github.com/users/kristen1980/gists{/gist_id}","starred_url":"https://api.github.com/users/kristen1980/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kristen1980/subscriptions","organizations_url":"https://api.github.com/users/kristen1980/orgs","repos_url":"https://api.github.com/users/kristen1980/repos","events_url":"https://api.github.com/users/kristen1980/events{/privacy}","received_events_url":"https://api.github.com/users/kristen1980/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-04-14T23:40:30Z","updated_at":"2016-04-15T21:26:44Z","closed_at":null,"body":"Hi,\r\n\r\nI have the following code:\r\n\r\n```\r\npackage main\r\n\r\nimport (\r\n\t\"bytes\"\r\n\t\"io/ioutil\"\r\n\t\"net/http\"\r\n\r\n\t\"github.com/PuerkitoBio/goquery\"\r\n)\r\nimport \"log\"\r\n\r\nfunc main() {\r\n\ts := `<body>\r\n                  <title>\r\n\t\t\t <a href=\"http://example.com/\" target=\"_blank\" gbkurl=\"http://example.com/page1/\">\r\n\t\t\t     <font color=\"#cc0000\">this stupid font</font>\r\n\t\t\t </a>\r\n\t\t\tthis text here and there\r\n\t\t   </title>\r\n\t\t</body>`\r\n\tresp := &http.Response{Request: &http.Request{}}\r\n\tresp.Request.Method = \"Get\"\r\n\tresp.Body = ioutil.NopCloser(bytes.NewBufferString(s))\r\n\tdoc, err := goquery.NewDocumentFromResponse(resp)\r\n\tif err != nil {\r\n\t\tlog.Fatal(err)\r\n\t}\r\n\ttitle := doc.Find(\"title\").Text()\r\n\tlog.Println(title)\r\n}\r\n\r\n```\r\nThis prints \r\n```\r\n<a href=\"http://example.com/\" target=\"_blank\" gbkurl=\"http://example.com/page1/\">\r\n<font color=\"#cc0000\">this stupid font</font>\r\n</a>\r\nthis text here and there\r\n```\r\nHowever, when I change the title tags to description (or just about any other tag) then search for said tag I get the expected outcome w/out html tags:\r\n\r\n```\r\nthis stupid font\r\n\r\nthis text here and there\r\n```\r\n\r\nIs this a bug? (btw this isn't my html it is a page I came across from scraping the title tags of various websites).\r\n\r\nIf this is a feature is there a way to extract the text from the title tag?"},"comment":{"url":"https://api.github.com/repos/PuerkitoBio/goquery/issues/comments/210652288","html_url":"https://github.com/PuerkitoBio/goquery/issues/104#issuecomment-210652288","issue_url":"https://api.github.com/repos/PuerkitoBio/goquery/issues/104","id":210652288,"user":{"login":"PuerkitoBio","id":692384,"avatar_url":"https://avatars.githubusercontent.com/u/692384?v=3","gravatar_id":"","url":"https://api.github.com/users/PuerkitoBio","html_url":"https://github.com/PuerkitoBio","followers_url":"https://api.github.com/users/PuerkitoBio/followers","following_url":"https://api.github.com/users/PuerkitoBio/following{/other_user}","gists_url":"https://api.github.com/users/PuerkitoBio/gists{/gist_id}","starred_url":"https://api.github.com/users/PuerkitoBio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PuerkitoBio/subscriptions","organizations_url":"https://api.github.com/users/PuerkitoBio/orgs","repos_url":"https://api.github.com/users/PuerkitoBio/repos","events_url":"https://api.github.com/users/PuerkitoBio/events{/privacy}","received_events_url":"https://api.github.com/users/PuerkitoBio/received_events","type":"User","site_admin":false},"created_at":"2016-04-15T21:26:44Z","updated_at":"2016-04-15T21:26:44Z","body":"Yes, that's a better solution. Note that you don't have to create a dummy http response, just use NewDocumentFromReader and strings.NewReader(str)."}}