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

Can't add support for a new site #9867

Closed
vojd11 opened this issue Jun 23, 2016 · 5 comments
Closed

Can't add support for a new site #9867

vojd11 opened this issue Jun 23, 2016 · 5 comments

Comments

@vojd11
Copy link

@vojd11 vojd11 commented Jun 23, 2016

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2016.06.23.1. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2016.06.23.1

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

Here my steps:
0.Start with this simple template and save it to youtube_dl/extractor/yourextractor.py
1.Add an import in youtube_dl/extractor/extractors.py
2.Run python test/test_download.py TestDownload.test_YourExtractor
3.

Traceback (most recent call last):
  File "youtube_dl/test/test_download.py", line 234, in <module>
    unittest.main()
  File "/usr/lib/python2.7/unittest/main.py", line 94, in __init__
    self.parseArgs(argv)
  File "/usr/lib/python2.7/unittest/main.py", line 149, in parseArgs
    self.createTests()
  File "/usr/lib/python2.7/unittest/main.py", line 158, in createTests
    self.module)
  File "/usr/lib/python2.7/unittest/loader.py", line 130, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
  File "/usr/lib/python2.7/unittest/loader.py", line 100, in loadTestsFromName
    parent, obj = obj, getattr(obj, part)
AttributeError: type object 'TestDownload' has no attribute 'test_YourExtractor'

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 23, 2016

What's the content of youtube_dl/extractor/yourextractor.py?

@vojd11
Copy link
Author

@vojd11 vojd11 commented Jun 23, 2016

Just trying with default

# coding: utf-8
from __future__ import unicode_literals

from .common import InfoExtractor


class YourExtractorIE(InfoExtractor):
    _VALID_URL = r'https?://(?:www\.)?yourextractor\.com/watch/(?P<id>[0-9]+)'
    _TEST = {
        'url': 'http://yourextractor.com/watch/42',
        'md5': 'TODO: md5 sum of the first 10241 bytes of the video file (use --test)',
        'info_dict': {
            'id': '42',
            'ext': 'mp4',
            'title': 'Video title goes here',
            'thumbnail': 're:^https?://.*\.jpg$',
            # TODO more properties, either as:
            # * A value
            # * MD5 checksum; start the string with md5:
            # * A regular expression; start the string with re:
            # * Any Python type (for example int or float)
        }
    }

    def _real_extract(self, url):
        video_id = self._match_id(url)
        webpage = self._download_webpage(url, video_id)

        # TODO more code goes here, for example ...
        title = self._html_search_regex(r'<h1>(.+?)</h1>', webpage, 'title')

        return {
            'id': video_id,
            'title': title,
            'description': self._og_search_description(webpage),
            'uploader': self._search_regex(r'<div[^>]+id="uploader"[^>]*>([^<]+)<', webpage, 'uploader', fatal=False),
            # TODO more properties (see youtube_dl/extractor/common.py)
        }
@vojd11
Copy link
Author

@vojd11 vojd11 commented Jun 23, 2016

also python youtube_dl/test/test_download.py --verbose TestDownload.test_Youtube or for any default extractor, works.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jun 23, 2016

And what's the additional line in youtube_dl/extractor/extractors.py?

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Jul 3, 2016

Closing as no response for a long time. Feel free to leave comments if you believe there's something wrong in youtube-dl's test system.

@yan12125 yan12125 closed this Jul 3, 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.