Avatar image for adam2marsh
#1 Edited by Adam2Marsh (10 posts) -

Evening All,

I'm in the process of creating a PHP WebApp (runs locally on PI) which downloads videos overnight (poor download speeds) so I can then transfer quickly onto Mac before the commute.

Everything was working fine until today when I can't download the premium videos, now I always thought it was weird as never attached my API key to the request but it would download. Now I get the error video advising couldn't authenticate me.

Thanks,
Adam

Avatar image for adam2marsh
#2 Posted by Adam2Marsh (10 posts) -

I had a search and was unable to find much information.... I'm assuming I need to perform authentication but unsure:

- exactly why it has just changed?

- also how to authenticate, can I send a post to giant bomb with credentials.

Thanks

Avatar image for szlifier
#3 Edited by Szlifier (1398 posts) -

@adam2marsh: There's a big change happening to how videos are served. More info here.

Here's a quote from that:

If its 3 or 4, You're going to need to append your API key to the video url or the RSS feed like this:

http://v.giantbomb.com/video.mp4?api_key=aaabbb111

Please note, you'll be limited to 20 video downloads a day downloaded this way.

For now it seems like the only way of doing what you want. I also do it this way and it's fine.

Avatar image for adam2marsh
#4 Edited by Adam2Marsh (10 posts) -

Thanks @szlifier, I remember reading that a while ago and as working never went and followed its advice.

Went ahead and made the change so now my API Key is being appended to my video my request but I'm still having the same issue, it downloads the authentication error video. Tried running as a wget and same problem so I at least know its not my code now :S Worth sending an email with the example wget I'm using?

Avatar image for szlifier
#5 Edited by Szlifier (1398 posts) -

@adam2marsh: It should work with just the api key attached. Can you check if it's actually in the GET query (e.g. in Wireshark)?

There's another thing that may affect you, but that would get you HTTP 403 an not the error video.

You have to send a custom User Agent header (can't be wget's default or empty). You can just put your username there - something that identifies you.

Like this:

wget --user-agent="Adam2Marsh fancy script" ...(the rest of the query)
Avatar image for adam2marsh
#6 Posted by Adam2Marsh (10 posts) -

@szlifier Thank you! that was it! :)

Set the User Agent on the wget with the api key and it downloaded the video. Made the Api Key change to my app, just need to try setting the php user-agent which handily can be set globally in the ini file which is perfect to test and can look at a better way afterwards.

Thanks for all your help! Really appreciate it!

Avatar image for szlifier
#7 Posted by Szlifier (1398 posts) -

@adam2marsh: Cool. I'm glad I could help a fellow Duder.

Avatar image for jaina_solo_
#8 Edited by Jaina_Solo_ (44 posts) -

[moved the comment to the proper thread]

Avatar image for tsigo
#9 Posted by tsigo (119 posts) -

@szlifier Thanks for the note about the user agent, that was the last piece of the puzzle!

Avatar image for adam2marsh
#10 Posted by Adam2Marsh (10 posts) -

Incase anyone is developing a PHP app and having these problems I solved by adding in the following line before streaming the video to be saved:

ini_set("user_agent","Adam2Marsh Laravel Video Downloader PI");

Avatar image for flamingmonky
#11 Posted by Flamingmonky (5 posts) -

Hello, I am having similar problems.

I have a python script that has stopped working and I am trying to work out what I am doing wrong. I append to API key so I will have a url like so.

http://v.giantbomb.com/2016/03/31/vf_killerinstinctseason3_ql_033116_4000.mp4&api_key=[my api key]

If I dump it in my browser I get "File not found." I then tried it with wget adding the user agent as you suggested and that gets me closer as this time it finds a file but gives me the you aren't authorised to view this video.

wget --user-agent="Flamingmonky" http://v.giantbomb.com/2016/03/31/vf_killerinstinctseason3_ql_033116_4000.mp4&api_key=[my api key]

Am I missing a wget arg or is this another issue?

Avatar image for szlifier
#12 Posted by Szlifier (1398 posts) -
Avatar image for flamingmonky
#13 Posted by Flamingmonky (5 posts) -

@szlifier: Well I feel silly :)

That did of course fix it, thank you very much!

Avatar image for tsigo
#14 Edited by tsigo (119 posts) -

Just a heads up, it seems something changed recently where the RSS feeds now include the `?api_key=[whatever]` parameter in the URL for every video, so if you were manually appending that value to the link passed to your downloader, like I was with wget, you'll be downloading the "This is an error message!" video.

Avatar image for wcarle
#15 Posted by wcarle (281 posts) -
Staff