Comments (12)
let me know if it works; happy to help if it doesnt.
from youpy.
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.
I can't pass the parameter like that, it says: Value expression expected
from youpy.
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.
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.
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.
Still not working.
But views, ratings, and author are shown completely.
only title returns "YouTube".
from youpy.
is it possible to share the video url you are trying to download? so i can try to reproduce.
from youpy.
it's happening for all the videos
from youpy.
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.
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from youpy.