Coder Social home page Coder Social logo

yt.title return 'YouTube' about youpy HOT 12 OPEN

AliAkhtari78 avatar AliAkhtari78 commented on September 9, 2024 1
yt.title return 'YouTube'

from youpy.

Comments (12)

emrebayramc avatar emrebayramc commented on September 9, 2024 1

let me know if it works; happy to help if it doesnt.

from youpy.

emrebayramc avatar emrebayramc commented on September 9, 2024

ok apperantly my initial instructions were wrong; when you change user agent and other request headers the response changes so it corrupts the parsing.

Instead you only need to pass cookies like this:

YouTubeItem('https://www.youtube.com/embed/B48hwisZvEI', request_headers={
'cookie':
})

I will update the instructions on medium post and here.
can you retry like this? I was able to get title correct when i did this.

from youpy.

AliAkhtari78 avatar AliAkhtari78 commented on September 9, 2024

I can't pass the parameter like that, it says: Value expression expected

from youpy.

emrebayramc avatar emrebayramc commented on September 9, 2024

sorry i should have written cleaner(actually i did but github removes the things i have written between "less than signs" anyways;). you need to put your cookie to the value section:

YouTubeItem('https://www.youtube.com/embed/B48hwisZvEI', request_headers={
'cookie': 'here should be your cookie'
})

from youpy.

AliAkhtari78 avatar AliAkhtari78 commented on September 9, 2024

Okay, but I have multiple value for my cookie , which one should I pass?
Can you look at the image below and tell me?
List Of YouTube Cookie

from youpy.

emrebayramc avatar emrebayramc commented on September 9, 2024

i dont know which one works when I get my cookies from chrome I take it like a string and pass all. something like this(below values are just dummy values as a sample);

YouTubeItem('https://www.youtube.com/embed/B48hwisZvEI', request_headers={
'cookie': "HSID=SDFJSDFJSD; SSID=sdf@31j2kjfk; APISID=!@JLFEJF@L!@/EJ@!JE!@;......"
})

from youpy.

AliAkhtari78 avatar AliAkhtari78 commented on September 9, 2024

Still not working.
But views, ratings, and author are shown completely.
only title returns "YouTube".

from youpy.

emrebayramc avatar emrebayramc commented on September 9, 2024

is it possible to share the video url you are trying to download? so i can try to reproduce.

from youpy.

AliAkhtari78 avatar AliAkhtari78 commented on September 9, 2024

it's happening for all the videos

from youpy.

emrebayramc avatar emrebayramc commented on September 9, 2024

Can you share how you are creating the YouTubeItem(please delete the values of your cookies etc while sharing; they are sensitive).
Because when I call like that there is no problem:

from YouPy import YouTubeItem

item = YouTubeItem('https://www.youtube.com/watch?v=B48hwisZvEI&t=21s', request_headers={
'cookie': 'my cookies'
})

print(item.title)

> RESISTANCE - Official Trailer I HD I IFC Films

maybe you are passing another request header too?

I will add some protective measures to the code today to prevent passing extras just to be sure.

from youpy.

AliAkhtari78 avatar AliAkhtari78 commented on September 9, 2024

yt = YouTubeItem(url=url, request_headers=header)
temp = {'title': yt.title, 'cover': yt.thumbnail_url, 'author': yt.author, 'views': yt.views, 'rating': yt.rating}
everything works fine except yt.title which return YouTube for me.
and here's the header:

header = {'Accept': '*/*',
          'Accept-Language': 'en-US,en;q=0.8',
          'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36',
          'X-Client-Data': '',
          'X-Goog-AuthUser': '0',
          'X-Goog-Visitor-Id': '',
          'x-origin': 'https://www.youtube.com',
          'X-YouTube-Client-Name': '1',
          'X-YouTube-Client-Version': '2.20200406.06.02',
          'X-YouTube-Device': 'cbr=Chrome&cbrver=80.0.3987.163&ceng=WebKit&cengver=537.36&cos=Windows&cosver=10.0',
          'X-Youtube-Identity-Token': '',
          'cookie': cookies
          }

from youpy.

emrebayramc avatar emrebayramc commented on September 9, 2024

Yes that is what I mean. You are sending too many extras with headers. You need to send only the cookie so your code should be:

header = {
          'cookie': cookies
          }
yt = YouTubeItem(url=url, request_headers=header)
temp = {'title': yt.title, 'cover': yt.thumbnail_url, 'author': yt.author, 'views': yt.views, 'rating': yt.rating}

otherwise based on the things you are sending on headers the response is changing and how PyTube and YouPy is doing is a simple string partsing. any change on response is affecting the retrieval of the title.

from youpy.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.