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

Error when using --write-description on some youtube videos #800

Closed
joaormatos opened this issue Apr 23, 2013 · 7 comments
Closed

Error when using --write-description on some youtube videos #800

joaormatos opened this issue Apr 23, 2013 · 7 comments

Comments

@joaormatos
Copy link

@joaormatos joaormatos commented Apr 23, 2013

youtube-dl: 2013.04.22
Python: 2.6.6
OS: Debian Squeeze GNU/Linux amd64

How to reproduce, as of 2013-04-23:

$ youtube-dl --write-description http://www.youtube.com/watch?v=fYzDtoYx4vU
[youtube] Setting language
[youtube] fYzDtoYx4vU: Downloading video webpage
[youtube] fYzDtoYx4vU: Downloading video info webpage
[youtube] fYzDtoYx4vU: Extracting video information
[info] Writing video description to: fYzDtoYx4vU.mp4.description
Traceback (most recent call last):
  File "/usr/lib/python2.6/runpy.py", line 122, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.6/runpy.py", line 34, in _run_code
    exec code in run_globals
  File "/afs/ist.utl.pt/users/1/1/ist162511/bin/youtube-dl/__main__.py", line 18, in <module>
  File "/afs/ist.utl.pt/users/1/1/ist162511/bin/youtube-dl/youtube_dl/__init__.py", line 558, in main

  File "/afs/ist.utl.pt/users/1/1/ist162511/bin/youtube-dl/youtube_dl/__init__.py", line 542, in _real_main

  File "/afs/ist.utl.pt/users/1/1/ist162511/bin/youtube-dl/youtube_dl/FileDownloader.py", line 684, in download
  File "/afs/ist.utl.pt/users/1/1/ist162511/bin/youtube-dl/youtube_dl/FileDownloader.py", line 468, in extract_info
  File "/afs/ist.utl.pt/users/1/1/ist162511/bin/youtube-dl/youtube_dl/FileDownloader.py", line 498, in process_ie_result
  File "/afs/ist.utl.pt/users/1/1/ist162511/bin/youtube-dl/youtube_dl/FileDownloader.py", line 600, in process_info
  File "/usr/lib/python2.6/io.py", line 1515, in write
    s.__class__.__name__)
TypeError: can't write str to text stream

I have only now begun using the --write-description option; this is the only video so far that produces this error.

@jaimeMF jaimeMF closed this in 69fc019 Apr 23, 2013
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Apr 23, 2013

In python2.7 the error is caused because it tries to write a str object, if the fix doesn't work in python2.6, please comment and I'll reopen the issue.

@phihag
Copy link
Contributor

@phihag phihag commented Apr 23, 2013

That's not really the problem though; we shouldn't have to default to an empty description in the first place.

@phihag phihag reopened this Apr 23, 2013
@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Apr 23, 2013

Ok, I've tested in python2.6 and it's also fixed.
But of course it fails with results that do not define the description. What is the desired behaviour: write an empty file or don't write anything?

@phihag
Copy link
Contributor

@phihag phihag commented Apr 23, 2013

http://www.youtube.com/watch?v=fYzDtoYx4vU should have a description; at least I can see one on the page! But yes, a more sensible default would be not registering the description field in the first place, and then not writing it.

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Apr 23, 2013

The problem is that the video is rated TV-14 and this is the page we get: https://gist.github.com/jaimeMF/5442645, see this lines: https://gist.github.com/jaimeMF/5442645#file-downloaded-html-L128-L131.

@phihag
Copy link
Contributor

@phihag phihag commented Apr 23, 2013

Oh, you're right, the page shows up differently when not logged in. However, a significant part of the description is still there.

@phihag phihag closed this in 7b670a4 Apr 23, 2013
@sebma
Copy link

@sebma sebma commented Oct 13, 2015

Hi, I have the same problem :

youtube-dl --verbose --ignore-config --write-description http://www.veoh.com/watch/v46093745wbEGkakh
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'--verbose', u'--ignore-config', u'--write-description', u'http://www.veoh.com/watch/v46093745wbEGkakh']
[debug] Encodings: locale UTF-8, fs UTF-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2015.10.13
[debug] Python version 2.7.8 - Linux-3.16.0-44-generic-x86_64-with-Ubuntu-14.10-utopic
[debug] exe versions: avconv 11.2-6, avprobe 11.2-6, ffmpeg 2.6.2, ffprobe 2.6.2, rtmpdump 2.4
[debug] Proxy map: {}
[Veoh] v46093745wbEGkakh: Downloading video XML
[info] Writing video description to: Pirates Of Silicon Valley-46093745.description
Traceback (most recent call last):
File "/usr/local/bin/youtube-dl", line 11, in
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/init.py", line 410, in main
_real_main(argv)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/init.py", line 400, in _real_main
retcode = ydl.download(all_urls)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 1665, in download
url, force_generic_extractor=self.params.get('force_generic_extractor', False))
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 671, in extract_info
return self.process_ie_result(ie_result, download, extra_info)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 717, in process_ie_result
return self.process_video_result(ie_result, download=download)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 1335, in process_video_result
self.process_info(new_info)
File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 1465, in process_info
descfile.write(info_dict['description'])
TypeError: must be unicode, not str

Any idea ?

Seb.

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
4 participants
You can’t perform that action at this time.