{"action":"opened","issue":{"url":"https://api.github.com/repos/scrapinghub/extruct/issues/113","repository_url":"https://api.github.com/repos/scrapinghub/extruct","labels_url":"https://api.github.com/repos/scrapinghub/extruct/issues/113/labels{/name}","comments_url":"https://api.github.com/repos/scrapinghub/extruct/issues/113/comments","events_url":"https://api.github.com/repos/scrapinghub/extruct/issues/113/events","html_url":"https://github.com/scrapinghub/extruct/issues/113","id":448960391,"node_id":"MDU6SXNzdWU0NDg5NjAzOTE=","number":113,"title":"Extruct returns incorrectly formatted description property","user":{"login":"jakubwasikowski","id":4014552,"node_id":"MDQ6VXNlcjQwMTQ1NTI=","avatar_url":"https://avatars0.githubusercontent.com/u/4014552?v=4","gravatar_id":"","url":"https://api.github.com/users/jakubwasikowski","html_url":"https://github.com/jakubwasikowski","followers_url":"https://api.github.com/users/jakubwasikowski/followers","following_url":"https://api.github.com/users/jakubwasikowski/following{/other_user}","gists_url":"https://api.github.com/users/jakubwasikowski/gists{/gist_id}","starred_url":"https://api.github.com/users/jakubwasikowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakubwasikowski/subscriptions","organizations_url":"https://api.github.com/users/jakubwasikowski/orgs","repos_url":"https://api.github.com/users/jakubwasikowski/repos","events_url":"https://api.github.com/users/jakubwasikowski/events{/privacy}","received_events_url":"https://api.github.com/users/jakubwasikowski/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-05-27T18:30:32Z","updated_at":"2019-05-27T18:30:32Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Seems that `extruct` incorrectly interprets description with included HTML tags from microdata.\r\n\r\nSee the below description extracted from URL https://www.monsterpetsupplies.co.uk/cat/cat-flea-tick/johnsons-4-fleas-cats-kittens:\r\n\r\n```python\r\n>>> import extruct\r\n>>> import requests\r\n>>> from w3lib.html import get_base_url\r\n>>> r = requests.get('https://www.monsterpetsupplies.co.uk/cat/cat-flea-tick/johnsons-4-fleas-cats-kittens')\r\n>>> base_url = get_base_url(r.text, r.url)\r\n>>> data = extruct.extract(r.text, base_url=base_url)\r\n>>> data['microdata'][0]['properties']['description']\r\n\"Johnsons 4 Fleas Cats & Kittens - 3 Treatment Pack, 6 Treatment PackFor use with Cats and Kittens over 4 weeks of age between 1 and 11kg.Johnson's 4fleas tablets are an easy to use oral treatment to kill adult fleas found on your pet.Effects on the fleas may be seen as soon as 15 minutes after administration.Between 95 - 100% of fleas will be killed off in the first six hours, but ALL adult fleas will be gone after a day.These tablets can be given directly to the mouth or may be mixed in a small portion f our pet's favourite food and given immediately. Administer a single tablet on an day when fleas are seen on your pet. Repeat on any subsequent day as necessary. Do not give more than one treatment per day.You may notice your pet scratching more than usual for the first half hour after administration; this is completely normal and caused by the fleas reacting to Johnson's 4Fleas tablets.While highly effective by themselves, 4Fleas is great when used as part of a programme to eliminate fleas and their larvae from both pets and their surroundings.\"\r\n```\r\nAs it can be seen, there is a problem with formatting, like lack of space between \"Pack\" and \"For\" or between \"11kg.\" and \"Johnson's\".\r\n\r\nIt turns out that the problem is not because of description property content per-se, because it looks correctly on the page source: \r\n\r\n```html\r\n<p><strong>Johnsons 4 Fleas Cats &amp; Kittens - 3 Treatment Pack, 6 Treatment Pack</strong></p>For use with Cats and Kittens over 4 weeks of age between 1 and 11kg.<br /><br />Johnson's 4fleas tablets are an easy to use oral treatment to kill adult fleas found on your pet.<br /><br />Effects on the fleas may be seen as soon as 15 minutes after administration.<br /><br />Between 95 - 100% of fleas will be killed off in the first six hours, but ALL adult fleas will be gone after a day.<br /><br />These tablets can be given directly to the mouth or may be mixed in a small portion f our pet's favourite food and given immediately. Administer a single tablet on an day when fleas are seen on your pet. Repeat on any subsequent day as necessary. Do not give more than one treatment per day.<br /><br />You may notice your pet scratching more than usual for the first half hour after administration; this is completely normal and caused by the fleas reacting to Johnson's 4Fleas tablets.<br /><br />While highly effective by themselves, 4Fleas is great when used as part of a programme to eliminate fleas and their larvae from both pets and their surroundings.\r\n```\r\n\r\nLikely it is a matter of line https://github.com/scrapinghub/extruct/blob/de219cb809676ecdf59dfe8f127a198764be5d4a/extruct/w3cmicrodata.py#L185 where html-text should be used instead of ad-hoc text extraction."}}
{"actor":{"display_login":"jakubwasikowski"}}