Skip to content

youtube detect fail #5860

Closed
Closed

Description

@alicera

Search before asking

Question

download new yolov5
command

python detect.py --source https://www.youtube.com/watch?v=ydYDqZQpim8
Model Summary: 213 layers, 7225885 parameters, 0 gradients
WARNING: Environment does not support cv2.imshow() or PIL Image.show() image displays
cv2.imshow() is disabled in Docker environments
Traceback (most recent call last):
  File "detect.py", line 243, in <module>
    main(opt)
  File "detect.py", line 238, in main
    run(**vars(opt))
  File "/opt/conda/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File "detect.py", line 92, in run
    dataset = LoadStreams(source, img_size=imgsz, stride=stride, auto=pt)
  File "/work/Pictures/YOLOv5/new_yolov5_1019/yolov5/123/yolov5/utils/datasets.py", line 306, in __init__
    s = pafy.new(s).getbest(preftype="mp4").url  # YouTube URL
  File "/opt/conda/lib/python3.8/site-packages/pafy/pafy.py", line 124, in new
    return Pafy(url, basic, gdata, size, callback, ydl_opts=ydl_opts)
  File "/opt/conda/lib/python3.8/site-packages/pafy/backend_youtube_dl.py", line 31, in __init__
    super(YtdlPafy, self).__init__(*args, **kwargs)
  File "/opt/conda/lib/python3.8/site-packages/pafy/backend_shared.py", line 97, in __init__
    self._fetch_basic()
  File "/opt/conda/lib/python3.8/site-packages/pafy/backend_youtube_dl.py", line 54, in _fetch_basic
    self._dislikes = self._ydl_info['dislike_count']
KeyError: 'dislike_count'

Additional

No response

Activity

  1. glenn-jocher commented on Dec 3, 2021

    @glenn-jocher
    Member

    @alicera thanks for the bug report. Yes I am able to reproduce the same error. Likely related to changes at YouTube unlike policy.

    Please raise this issue directly at https://github.com/mps-youtube/pafy and https://github.com/ytdl-org/youtube-dl which are the packages responsible for downloading and parsing YouTube videos and metadata.

  2. added
    bugSomething isn't working
    and removed
    questionFurther information is requested
    on Dec 3, 2021
  3. mbgpriyanka commented on Dec 5, 2021

    @mbgpriyanka

    @alicera - got the same error but solved it using-
    !pip uninstall -y pafy
    !pip install git+https://github.com/Cupcakus/pafy
    then run the detection onthe youtube link -works!

  4. alicera commented on Dec 6, 2021

    @alicera
    Author

    Solved it. Thanks for your help.

  5. glenn-jocher commented on Dec 13, 2021

    @glenn-jocher
    Member
  6. glenn-jocher commented on Feb 11, 2022

    @glenn-jocher
    Member

    @hdnh2006 you're saying instead of:

    pip install -U youtube-dl git+https://github.com/Cupcakus/pafy
    

    run this?

    pip install -U youtube-dl==2020.12.2 pafy
    

    EDIT: seems to also work. Pinning the pip package is probably preferable to the git install, I'll submit a PR

  7. asparmar14 commented on Sep 15, 2022

    @asparmar14

    @alicera - got the same error but solved it using- !pip uninstall -y pafy !pip install git+https://github.com/Cupcakus/pafy then run the detection onthe youtube link -works!

    Thanks this help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions