{"action":"created","comment":{"url":"https://api.github.com/repos/rg3/youtube-dl/pulls/comments/59134523","id":59134523,"diff_hunk":"@@ -0,0 +1,78 @@\n+# coding: utf-8\n+from __future__ import unicode_literals\n+import re\n+\n+from .common import InfoExtractor\n+from ..utils import str_to_int\n+\n+\n+class PressTVIE(InfoExtractor):\n+    _VALID_URL = r'https?://(?:www\\.)?presstv\\.ir/[^/]+/(?P<y>[0-9]+)/(?P<m>[0-9]+)/(?P<d>[0-9]+)/(?P<id>[0-9]+)/'\n+\n+    _TEST = {\n+        'url': 'http://www.presstv.ir/Detail/2016/04/09/459911/Australian-sewerage-treatment-facility-/',\n+        'md5': '5d7e3195a447cb13e9267e931d8dd5a5',\n+        'info_dict': {\n+            'id': '459911',\n+            'ext': 'mp4',\n+            'title': 'Organic mattresses used to clean waste water',\n+            'upload_date': '20160409',\n+            'thumbnail': 'http://media.presstv.com/photo/20160409/41719129-76fa-4372-a09d-bf348278eb5d.jpg',\n+            'description': ('A trial program at an Australian sewerage treatment facility hopes to change '\n+                            'the way waste water is treated by using plant mattresses to reduce chemical '\n+                            'and electricity use.')\n+        }\n+    }\n+\n+    def _real_extract(self, url):\n+        video_id = self._match_id(url)\n+        webpage = self._download_webpage(url, video_id)\n+\n+        # extract video URL from webpage\n+        video_url = self._html_search_regex(r'<input type=\"hidden\" id=\"inpPlayback\" value=\"([^\"]+)\" />', webpage,\n+                                            'Video URL')\n+\n+        # build list of available formats\n+        # specified in http://www.presstv.ir/Scripts/playback.js\n+        base_url = 'http://192.99.219.222:82/presstv'\n+        formats = [\n+            {\n+                'url': base_url + video_url,\n+                'format': '1080p mp4',\n+                'format_id': '1080p'\n+            }, {\n+                'url': base_url + video_url.replace(\".mp4\", \"_low800.mp4\"),\n+                'format': '720p mp4',\n+                'format_id': '720p'\n+            }, {\n+                'url': base_url + video_url.replace(\".mp4\", \"_low400.mp4\"),\n+                'format': '360p mp4',\n+                'format_id': '360p'\n+            }, {\n+                'url': base_url + video_url.replace(\".mp4\", \"_low200.mp4\"),\n+                'format': '180p mp4',\n+                'format_id': '180p'\n+            }\n+        ]\n+        formats.reverse()\n+\n+        # extract video metadata\n+        title = self._html_search_meta('title', webpage, 'Title', True)\n+        title = title.partition('-')[2].strip()\n+\n+        thumbnail = self._html_search_meta('og:image', webpage, 'Thumbnail', True)\n+        description = self._html_search_meta('og:description', webpage, 'Description', True)","path":"youtube_dl/extractor/presstv.py","position":64,"original_position":64,"commit_id":"95153a960d098d75e6100e38e77fdaa32f5267a2","original_commit_id":"95153a960d098d75e6100e38e77fdaa32f5267a2","user":{"login":"yan12125","id":1937689,"avatar_url":"https://avatars.githubusercontent.com/u/1937689?v=3","gravatar_id":"","url":"https://api.github.com/users/yan12125","html_url":"https://github.com/yan12125","followers_url":"https://api.github.com/users/yan12125/followers","following_url":"https://api.github.com/users/yan12125/following{/other_user}","gists_url":"https://api.github.com/users/yan12125/gists{/gist_id}","starred_url":"https://api.github.com/users/yan12125/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yan12125/subscriptions","organizations_url":"https://api.github.com/users/yan12125/orgs","repos_url":"https://api.github.com/users/yan12125/repos","events_url":"https://api.github.com/users/yan12125/events{/privacy}","received_events_url":"https://api.github.com/users/yan12125/received_events","type":"User","site_admin":false},"body":"Use ```self._og_search_*``` functions here.","created_at":"2016-04-10T14:06:47Z","updated_at":"2016-04-10T14:06:47Z","html_url":"https://github.com/rg3/youtube-dl/pull/7113#discussion_r59134523","pull_request_url":"https://api.github.com/repos/rg3/youtube-dl/pulls/7113","_links":{"self":{"href":"https://api.github.com/repos/rg3/youtube-dl/pulls/comments/59134523"},"html":{"href":"https://github.com/rg3/youtube-dl/pull/7113#discussion_r59134523"},"pull_request":{"href":"https://api.github.com/repos/rg3/youtube-dl/pulls/7113"}}},"pull_request":{"url":"https://api.github.com/repos/rg3/youtube-dl/pulls/7113","id":47293584,"html_url":"https://github.com/rg3/youtube-dl/pull/7113","diff_url":"https://github.com/rg3/youtube-dl/pull/7113.diff","patch_url":"https://github.com/rg3/youtube-dl/pull/7113.patch","issue_url":"https://api.github.com/repos/rg3/youtube-dl/issues/7113","number":7113,"state":"open","locked":false,"title":"[presstv] Added extractor for PressTV.","user":{"login":"Phaeilo","id":1131081,"avatar_url":"https://avatars.githubusercontent.com/u/1131081?v=3","gravatar_id":"","url":"https://api.github.com/users/Phaeilo","html_url":"https://github.com/Phaeilo","followers_url":"https://api.github.com/users/Phaeilo/followers","following_url":"https://api.github.com/users/Phaeilo/following{/other_user}","gists_url":"https://api.github.com/users/Phaeilo/gists{/gist_id}","starred_url":"https://api.github.com/users/Phaeilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Phaeilo/subscriptions","organizations_url":"https://api.github.com/users/Phaeilo/orgs","repos_url":"https://api.github.com/users/Phaeilo/repos","events_url":"https://api.github.com/users/Phaeilo/events{/privacy}","received_events_url":"https://api.github.com/users/Phaeilo/received_events","type":"User","site_admin":false},"body":"Fixes #7060","created_at":"2015-10-09T16:41:08Z","updated_at":"2016-04-10T14:06:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b7a6c9f6a231e653b65ea734541e0d32e1b0bbc8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/rg3/youtube-dl/pulls/7113/commits","review_comments_url":"https://api.github.com/repos/rg3/youtube-dl/pulls/7113/comments","review_comment_url":"https://api.github.com/repos/rg3/youtube-dl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/rg3/youtube-dl/issues/7113/comments","statuses_url":"https://api.github.com/repos/rg3/youtube-dl/statuses/95153a960d098d75e6100e38e77fdaa32f5267a2","head":{"label":"Phaeilo:presstv","ref":"presstv","sha":"95153a960d098d75e6100e38e77fdaa32f5267a2","user":{"login":"Phaeilo","id":1131081,"avatar_url":"https://avatars.githubusercontent.com/u/1131081?v=3","gravatar_id":"","url":"https://api.github.com/users/Phaeilo","html_url":"https://github.com/Phaeilo","followers_url":"https://api.github.com/users/Phaeilo/followers","following_url":"https://api.github.com/users/Phaeilo/following{/other_user}","gists_url":"https://api.github.com/users/Phaeilo/gists{/gist_id}","starred_url":"https://api.github.com/users/Phaeilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Phaeilo/subscriptions","organizations_url":"https://api.github.com/users/Phaeilo/orgs","repos_url":"https://api.github.com/users/Phaeilo/repos","events_url":"https://api.github.com/users/Phaeilo/events{/privacy}","received_events_url":"https://api.github.com/users/Phaeilo/received_events","type":"User","site_admin":false},"repo":{"id":43655263,"name":"youtube-dl","full_name":"Phaeilo/youtube-dl","owner":{"login":"Phaeilo","id":1131081,"avatar_url":"https://avatars.githubusercontent.com/u/1131081?v=3","gravatar_id":"","url":"https://api.github.com/users/Phaeilo","html_url":"https://github.com/Phaeilo","followers_url":"https://api.github.com/users/Phaeilo/followers","following_url":"https://api.github.com/users/Phaeilo/following{/other_user}","gists_url":"https://api.github.com/users/Phaeilo/gists{/gist_id}","starred_url":"https://api.github.com/users/Phaeilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Phaeilo/subscriptions","organizations_url":"https://api.github.com/users/Phaeilo/orgs","repos_url":"https://api.github.com/users/Phaeilo/repos","events_url":"https://api.github.com/users/Phaeilo/events{/privacy}","received_events_url":"https://api.github.com/users/Phaeilo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Phaeilo/youtube-dl","description":"Small command-line program to download videos from YouTube.com and other video sites","fork":true,"url":"https://api.github.com/repos/Phaeilo/youtube-dl","forks_url":"https://api.github.com/repos/Phaeilo/youtube-dl/forks","keys_url":"https://api.github.com/repos/Phaeilo/youtube-dl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Phaeilo/youtube-dl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Phaeilo/youtube-dl/teams","hooks_url":"https://api.github.com/repos/Phaeilo/youtube-dl/hooks","issue_events_url":"https://api.github.com/repos/Phaeilo/youtube-dl/issues/events{/number}","events_url":"https://api.github.com/repos/Phaeilo/youtube-dl/events","assignees_url":"https://api.github.com/repos/Phaeilo/youtube-dl/assignees{/user}","branches_url":"https://api.github.com/repos/Phaeilo/youtube-dl/branches{/branch}","tags_url":"https://api.github.com/repos/Phaeilo/youtube-dl/tags","blobs_url":"https://api.github.com/repos/Phaeilo/youtube-dl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Phaeilo/youtube-dl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Phaeilo/youtube-dl/git/refs{/sha}","trees_url":"https://api.github.com/repos/Phaeilo/youtube-dl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Phaeilo/youtube-dl/statuses/{sha}","languages_url":"https://api.github.com/repos/Phaeilo/youtube-dl/languages","stargazers_url":"https://api.github.com/repos/Phaeilo/youtube-dl/stargazers","contributors_url":"https://api.github.com/repos/Phaeilo/youtube-dl/contributors","subscribers_url":"https://api.github.com/repos/Phaeilo/youtube-dl/subscribers","subscription_url":"https://api.github.com/repos/Phaeilo/youtube-dl/subscription","commits_url":"https://api.github.com/repos/Phaeilo/youtube-dl/commits{/sha}","git_commits_url":"https://api.github.com/repos/Phaeilo/youtube-dl/git/commits{/sha}","comments_url":"https://api.github.com/repos/Phaeilo/youtube-dl/comments{/number}","issue_comment_url":"https://api.github.com/repos/Phaeilo/youtube-dl/issues/comments{/number}","contents_url":"https://api.github.com/repos/Phaeilo/youtube-dl/contents/{+path}","compare_url":"https://api.github.com/repos/Phaeilo/youtube-dl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Phaeilo/youtube-dl/merges","archive_url":"https://api.github.com/repos/Phaeilo/youtube-dl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Phaeilo/youtube-dl/downloads","issues_url":"https://api.github.com/repos/Phaeilo/youtube-dl/issues{/number}","pulls_url":"https://api.github.com/repos/Phaeilo/youtube-dl/pulls{/number}","milestones_url":"https://api.github.com/repos/Phaeilo/youtube-dl/milestones{/number}","notifications_url":"https://api.github.com/repos/Phaeilo/youtube-dl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Phaeilo/youtube-dl/labels{/name}","releases_url":"https://api.github.com/repos/Phaeilo/youtube-dl/releases{/id}","deployments_url":"https://api.github.com/repos/Phaeilo/youtube-dl/deployments","created_at":"2015-10-04T22:30:09Z","updated_at":"2016-02-04T17:39:53Z","pushed_at":"2016-04-10T13:53:27Z","git_url":"git://github.com/Phaeilo/youtube-dl.git","ssh_url":"git@github.com:Phaeilo/youtube-dl.git","clone_url":"https://github.com/Phaeilo/youtube-dl.git","svn_url":"https://github.com/Phaeilo/youtube-dl","homepage":"http://rg3.github.io/youtube-dl/","size":36245,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"rg3:master","ref":"master","sha":"6c4c7539f222cd9e80dfae0b1c9dabbd45d1b3dc","user":{"login":"rg3","id":53487,"avatar_url":"https://avatars.githubusercontent.com/u/53487?v=3","gravatar_id":"","url":"https://api.github.com/users/rg3","html_url":"https://github.com/rg3","followers_url":"https://api.github.com/users/rg3/followers","following_url":"https://api.github.com/users/rg3/following{/other_user}","gists_url":"https://api.github.com/users/rg3/gists{/gist_id}","starred_url":"https://api.github.com/users/rg3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rg3/subscriptions","organizations_url":"https://api.github.com/users/rg3/orgs","repos_url":"https://api.github.com/users/rg3/repos","events_url":"https://api.github.com/users/rg3/events{/privacy}","received_events_url":"https://api.github.com/users/rg3/received_events","type":"User","site_admin":false},"repo":{"id":1039520,"name":"youtube-dl","full_name":"rg3/youtube-dl","owner":{"login":"rg3","id":53487,"avatar_url":"https://avatars.githubusercontent.com/u/53487?v=3","gravatar_id":"","url":"https://api.github.com/users/rg3","html_url":"https://github.com/rg3","followers_url":"https://api.github.com/users/rg3/followers","following_url":"https://api.github.com/users/rg3/following{/other_user}","gists_url":"https://api.github.com/users/rg3/gists{/gist_id}","starred_url":"https://api.github.com/users/rg3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rg3/subscriptions","organizations_url":"https://api.github.com/users/rg3/orgs","repos_url":"https://api.github.com/users/rg3/repos","events_url":"https://api.github.com/users/rg3/events{/privacy}","received_events_url":"https://api.github.com/users/rg3/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rg3/youtube-dl","description":"Small command-line program to download videos from YouTube.com and other video sites","fork":false,"url":"https://api.github.com/repos/rg3/youtube-dl","forks_url":"https://api.github.com/repos/rg3/youtube-dl/forks","keys_url":"https://api.github.com/repos/rg3/youtube-dl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rg3/youtube-dl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rg3/youtube-dl/teams","hooks_url":"https://api.github.com/repos/rg3/youtube-dl/hooks","issue_events_url":"https://api.github.com/repos/rg3/youtube-dl/issues/events{/number}","events_url":"https://api.github.com/repos/rg3/youtube-dl/events","assignees_url":"https://api.github.com/repos/rg3/youtube-dl/assignees{/user}","branches_url":"https://api.github.com/repos/rg3/youtube-dl/branches{/branch}","tags_url":"https://api.github.com/repos/rg3/youtube-dl/tags","blobs_url":"https://api.github.com/repos/rg3/youtube-dl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rg3/youtube-dl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rg3/youtube-dl/git/refs{/sha}","trees_url":"https://api.github.com/repos/rg3/youtube-dl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rg3/youtube-dl/statuses/{sha}","languages_url":"https://api.github.com/repos/rg3/youtube-dl/languages","stargazers_url":"https://api.github.com/repos/rg3/youtube-dl/stargazers","contributors_url":"https://api.github.com/repos/rg3/youtube-dl/contributors","subscribers_url":"https://api.github.com/repos/rg3/youtube-dl/subscribers","subscription_url":"https://api.github.com/repos/rg3/youtube-dl/subscription","commits_url":"https://api.github.com/repos/rg3/youtube-dl/commits{/sha}","git_commits_url":"https://api.github.com/repos/rg3/youtube-dl/git/commits{/sha}","comments_url":"https://api.github.com/repos/rg3/youtube-dl/comments{/number}","issue_comment_url":"https://api.github.com/repos/rg3/youtube-dl/issues/comments{/number}","contents_url":"https://api.github.com/repos/rg3/youtube-dl/contents/{+path}","compare_url":"https://api.github.com/repos/rg3/youtube-dl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rg3/youtube-dl/merges","archive_url":"https://api.github.com/repos/rg3/youtube-dl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rg3/youtube-dl/downloads","issues_url":"https://api.github.com/repos/rg3/youtube-dl/issues{/number}","pulls_url":"https://api.github.com/repos/rg3/youtube-dl/pulls{/number}","milestones_url":"https://api.github.com/repos/rg3/youtube-dl/milestones{/number}","notifications_url":"https://api.github.com/repos/rg3/youtube-dl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rg3/youtube-dl/labels{/name}","releases_url":"https://api.github.com/repos/rg3/youtube-dl/releases{/id}","deployments_url":"https://api.github.com/repos/rg3/youtube-dl/deployments","created_at":"2010-10-31T14:35:07Z","updated_at":"2016-04-10T13:55:56Z","pushed_at":"2016-04-10T13:53:28Z","git_url":"git://github.com/rg3/youtube-dl.git","ssh_url":"git@github.com:rg3/youtube-dl.git","clone_url":"https://github.com/rg3/youtube-dl.git","svn_url":"https://github.com/rg3/youtube-dl","homepage":"http://rg3.github.io/youtube-dl/","size":109973,"stargazers_count":16521,"watchers_count":16521,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":3231,"mirror_url":null,"open_issues_count":1396,"forks":3231,"open_issues":1396,"watchers":16521,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/rg3/youtube-dl/pulls/7113"},"html":{"href":"https://github.com/rg3/youtube-dl/pull/7113"},"issue":{"href":"https://api.github.com/repos/rg3/youtube-dl/issues/7113"},"comments":{"href":"https://api.github.com/repos/rg3/youtube-dl/issues/7113/comments"},"review_comments":{"href":"https://api.github.com/repos/rg3/youtube-dl/pulls/7113/comments"},"review_comment":{"href":"https://api.github.com/repos/rg3/youtube-dl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/rg3/youtube-dl/pulls/7113/commits"},"statuses":{"href":"https://api.github.com/repos/rg3/youtube-dl/statuses/95153a960d098d75e6100e38e77fdaa32f5267a2"}}}}