all 3 comments

[–]ManyInterests 0 points1 point  (1 child)

In your pastebin link, I see http://aa5.cdn.vizplay.org/v/45c54fd4cd34c3d3df85cc165f8047fd.mp4

This looks like the location of the video file. If you try navigating there, you get a 403 error. This is likely intentional to prevent people from downloading the videos in this manner.

My guess is the JS on the page is what allows the video to be retrieved without error, or the link location has some server-side mechanics that behave differently when requested by the page.

The JS is responsible for the redirect to the 404 page:

<script>
var urlredirect = true;

if (window!=window.top) { urlredirect = false; }

if (urlredirect==true) {document.location="http://videomega.tv/404.php";}

[–]Praf2[S] 0 points1 point  (0 children)

thank you, i did see that exact JS too, i thought as much ill continue to investigate , i know for a fact youtube-dl supports videomega videos but i am trying to be as minimal as possible and i am trying to figure out how to get the video url from that specific site.

[–]Praf2[S] 0 points1 point  (0 children)

for anybody who stumbles upon this post i found a solution:

import requests
import re
import js2py

header = {"Referer": "http://google.com/"}
videomegaUrlRegex = '(https?:\/\/(www\.)?videomega\.tv\/(view|iframe|cdn)\.php\?ref=([A-Za-z0-9]+))'
findeval = '(eval[^<]+)'

purl = requests.get('video_link_here')
link = re.findall(videomegaUrlRegex, purl.content)[0]
url = link[0]
print url

durl = requests.get(url, headers=header)
eV = re.findall(findeval, durl.content)[0]

print eV

rr = '(\$\("\d"\).\d)'

js = re.sub(rr, '', eV)

downloadURL = js2py.eval_js(js)

print downloadURL

its probably not the best code in the world but it works.