Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access forbidden error for the website http://www.acfun.tv #10051

Closed
arealdeadone opened this issue Jul 9, 2016 · 1 comment
Closed

Access forbidden error for the website http://www.acfun.tv #10051

arealdeadone opened this issue Jul 9, 2016 · 1 comment

Comments

@arealdeadone
Copy link

@arealdeadone arealdeadone commented Jul 9, 2016

I was trying to add an extractor for the the website http://www.acfun.tv so while running the tests the following output was generated

D:\Arvind Rachuri\Code\Open Source\youtube-dl>python -m youtube_dl http://acfun.tv/v/ac2876205 -v
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['http://acfun.tv/v/ac2876205', '-v']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2016.07.07
[debug] Git HEAD: 29c4a07
[debug] Python version 3.4.4 - Windows-7-6.1.7600-SP0
[debug] exe versions: none
[debug] Proxy map: {}
[generic] ac2876205: Requesting header
[redirect] Following redirect to http://www.acfun.tv/v/ac2876205
[generic] ac2876205: Requesting header
WARNING: Could not send HEAD request to http://www.acfun.tv/v/ac2876205: HTTP Error 403: Forbidden
[generic] ac2876205: Downloading webpage
WARNING: Falling back on generic information extractor.
[generic] ac2876205: Extracting information
ERROR: Unsupported URL: http://www.acfun.tv/v/ac2876205
Traceback (most recent call last):
  File "D:\Arvind Rachuri\Code\Open Source\youtube-dl\youtube_dl\YoutubeDL.py", line 681, in extract_info
    ie_result = ie.extract(url)
  File "D:\Arvind Rachuri\Code\Open Source\youtube-dl\youtube_dl\extractor\common.py", line 343, in extract
    return self._real_extract(url)
  File "D:\Arvind Rachuri\Code\Open Source\youtube-dl\youtube_dl\extractor\generic.py", line 2237, in _real_extract
    raise UnsupportedError(url)
youtube_dl.utils.UnsupportedError: Unsupported URL: http://www.acfun.tv/v/ac2876205

My Python extractor code:

from .common import InfoExtractor

from re import match

class AcfunIE(InfoExtractor):
    _VALID_URL = r'(?:https?://)?(?:www\.)?acfun\.tv/v/(?P<id>\w+)'
    _TEST = {
        u'url': u'http://www.acfun.tv/v/ac2876205',
        u'file': u'2876205.mp4',
        u'info_dict': {
            u"id": u"2876205",
            u"ext": u"mp4",
            u"title": u"坐稳了,别跳起来!盘点电影中那些吓人的片段!."
        }
    }

    def _real_extract(self, url):
        mobj = match(self._VALID_URL)

        video_id = mobj.group('id')
        webpage_url = 'https://acfun.tv/v/'+video_id
        webpage = self._download_webpage(webpage_url,video_id)

        self.report_extraction(video_id)
        video_url = self._html_search_regex(r'<iframe id="ACFlashPlayer-re" frameborder="0" allowfullscreen="" style="height: 592px; width: 980px; left: 0px; top: 0px;" src="(.+?)">',webpage, u'video URL')

        return {
            'id': video_id,
            'url': video_url,
            'ext': 'mp4',
            'title': self._html_search_regex(r'<h1 id="txt-title-view">(.+?)</h1>',webpage,u'Title')
        }

Why is this warning is being generated?

WARNING: Could not send HEAD request to http://www.acfun.tv/v/ac2876205: HTTP Error 403: Forbidden

Please help

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Jul 9, 2016

@dstftw dstftw closed this Jul 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.