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

Twitch fails when --download-archive present. #2705

Closed
Hajitorus opened this issue Apr 5, 2014 · 2 comments
Closed

Twitch fails when --download-archive present. #2705

Hajitorus opened this issue Apr 5, 2014 · 2 comments

Comments

@Hajitorus
Copy link

@Hajitorus Hajitorus commented Apr 5, 2014

I have a --download-archive clause present in ~/.config/youtube-dl.conf, and use --download-archive /dev/null to circumvent this when needed. However, twitch URLs appear to not produce an ID that the archiving system can use, producing this error:

% youtube-dl --download-archive /dev/null http://www.twitch.tv/therealtakeshi/b/516100842
[justin.tv] 516100842: Extracting information
[justin.tv] 516100842: Downloading video info JSON
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/bin/youtube-dl/__main__.py", line 18, in <module>
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 836, in main
  File "/usr/local/bin/youtube-dl/youtube_dl/__init__.py", line 826, in _real_main
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1033, in download
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 522, in extract_info
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 656, in process_ie_result
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 559, in process_ie_result
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 814, in process_video_result
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 839, in process_info
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 479, in _match_entry
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1099, in in_download_archive
  File "/usr/local/bin/youtube-dl/youtube_dl/YoutubeDL.py", line 1092, in _make_archive_id
TypeError: coercing to Unicode: need string or buffer, int found

Moving my youtube-dl.conf aside and retrying (without any --download-archive option) works fine. I pulled down a local copy and was able to fix this bug (for me) by coercing info_dict[id] to string:

diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 5794fdb..c8e1482 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -1089,7 +1089,7 @@ class YoutubeDL(object):
                 extractor = info_dict.get('ie_key')  # key in a playlist
         if extractor is None:
             return None  # Incomplete video information
-        return extractor.lower() + ' ' + info_dict['id']
+        return extractor.lower() + ' ' + str(info_dict['id'])

     def in_download_archive(self, info_dict):
         fn = self.params.get('download_archive')

I'm not sure if this is the right fix or if extractors should be forced to ensure id is a string?

@Hajitorus
Copy link
Author

@Hajitorus Hajitorus commented Apr 5, 2014

… on second thought, justintv might need to return something more unique to work with download archive, probably at least <username>/b/<id> or whatever is appropriate based on the input URI?

@phihag
Copy link
Contributor

@phihag phihag commented Apr 5, 2014

My understanding is that the numeric Id is already unique (it's certainly large enough). The justin.tv extractor is at fault here, not the download_archive code, since video IDs are supposed to. Fixed, thank you very much for the report!

@phihag phihag closed this in ee1e199 Apr 5, 2014
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.