This script scrapes the HTML from different web pages to get the information from the video and you can use it in your own video player.

Overview

XVideos PornHub RedTube API

This script scrapes the HTML from different web pages to get the information from the video and you can use it in your own video player.

Features

  • Get video sources (MP4, HLS)
  • Get thumbnail (poster)
  • Get thumbnails for preview (VTT)
  • Add new sites / servers
  • Data caching

Installation

Copy the dir to the root of a web server running PHP 7.

Usage

Only get requests are accepted, so data can be entered directly in url

Parameter Description
site_id id of the site that wants to get the video (xvideos, pornhub, redtube)
video_id id of the video that corresponds to the site
data link to the video, with at least the domain name and video id

Example

<?php

$data = file_get_contents('http://localhost/api/?site_id=xvideos&video_id=59934029');
echo '<pre>';
print_r(json_decode($data, true));
echo '</pre>';

Output

Array
(
    [hls] => Array
        (
            [all] => https://cdn77-vid.xvideos-cdn.com/EzxFnSwy-9fX68oCPYYOhw==,1631685848/videos/hls/de/b6/c0/deb6c040575ef28dee0d5a0240c4b04d/hls.m3u8
        )

    [mp4] => Array
        (
            [high] => https://cdn77-vid.xvideos-cdn.com/ZeDUyLXiZDKCXlc_9G72Fg==,1631685848/videos/mp4/d/e/b/xvideos.com_deb6c040575ef28dee0d5a0240c4b04d.mp4?ui=MTg1LjE1Ni4yMTkuMTQ0LS9lbWJlZGZyYW1lLzU5OTM0MDI5P3I9MTYzMTY3NQ==
            [low] => https://cdn77-vid.xvideos-cdn.com/XSSyMypFsDouI49r6eYB1Q==,1631685848/videos/3gp/d/e/b/xvideos.com_deb6c040575ef28dee0d5a0240c4b04d.mp4?ui=MTg1LjE1Ni4yMTkuMTQ0LS9lbWJlZGZyYW1lLzU5OTM0MDI5P3I9MTYzMTY3NQ==
        )

    [thumb] => https://cdn77-pic.xvideos-cdn.com/videos/thumbs169lll/de/b6/c0/deb6c040575ef28dee0d5a0240c4b04d/deb6c040575ef28dee0d5a0240c4b04d.25.jpg
    [thumbnails] => http://localhost/api/vtt/eHZpZGVvc3h4eHh4eHh4eIQuPOZKjQDosFrBVWNZOX1KtJt9dZbonjIEXI50IzTCrzqFJoAHlahbZQvC2DdXp-Fx1XhsmsiS643j1783hqaMKYgHFUVR1ph-tCBP2ByTCxE2ni-4TgPLbJJgPrhn10OGgFbkncuOfWDjBrXTo_JBJVbsCq85Ipu_heIsBn3i3bUILlOw6zTr3HihbIGhvlgHiZc7ZG4nU0ra1FpYV5plkTAn8SQwnPyR9mGsujpEurWSj2YRL3Nd2fAlAn-CC93AYFt_YaSS2HA2ZtJw6J-W6wiO0V3V4DYuciNb2BB5lFd7N9sUfFnu9PPSj2Xnx9dsr8vFrbpwha17rAepm4c=
)

Example online

https://appsdev.cyou/xv-ph-rt/

How to add more sites / servers

There's a file sources.json, that has the information of all the sites to which the HTML will be extracted, in this it's indicated all the data that can be extracted to the site, for example, HLS, MP4, thumbnails.

It's recommended that the sites have different IP addresses.

In case of adding your own site, add folder api-for-own-servers anywhere on your site so that data can be extracted from it.

Categorize sites

To avoid making dozens of requests and waiting for them all to complete, sites are categorized by loading speed, the first ones will be the fastest (1s, 2s), and the next ones will be slower (3s, 4s, 5s).

How it work

The data is extracted from all the sites in the first category, and if all the data is obtained, no more data is extracted, otherwise, it will continue with the next category until all the data is obtained.

Caution

By default there's a list of sites to obtain data but as they're from third parties there is a risk that they may stop working, so it's recommended that you add your own sites / servers.

You might also like...
Goutte, a simple PHP Web Scraper

Goutte, a simple PHP Web Scraper Goutte is a screen scraping and web crawling library for PHP. Goutte provides a nice API to crawl websites and extrac

PHP Scraper - an highly opinionated web-interface for PHP
PHP Scraper - an highly opinionated web-interface for PHP

PHP Scraper An opinionated & limited way to scrape the web using PHP. The main goal is to get stuff done instead of getting distracted with xPath sele

Goutte, a simple PHP Web Scraper

Goutte, a simple PHP Web Scraper Goutte is a screen scraping and web crawling library for PHP. Goutte provides a nice API to crawl websites and extrac

The most integrated web scraper package for Laravel.
The most integrated web scraper package for Laravel.

Laravel Scavenger The most integrated web scraper package for Laravel. Top Features Scavenger provides the following features and more out-the-box. Ea

Property page web scrapper
Property page web scrapper

Property page web scrapper This tool was built to expermiment with extracting features for property pages on websites like booking.com and Airbnb. Thi

Roach is a complete web scraping toolkit for PHP

🐴 Roach A complete web scraping toolkit for PHP About Roach is a complete web scraping toolkit for PHP. It is heavily inspired (read: a shameless clo

Libraries and scripts for crawling the TYPO3 page tree. Used for re-caching, re-indexing, publishing applications etc.

Libraries and scripts for crawling the TYPO3 page tree. Used for re-caching, re-indexing, publishing applications etc.

PHP scraper for ZEE5 Live Streaming URL's Using The Channel ID and Direct Play Anywhere
PHP scraper for ZEE5 Live Streaming URL's Using The Channel ID and Direct Play Anywhere

It can scrape ZEE5 Live Streaming URL's Using The Channel ID and Direct Play Anywhere

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very usefull when you're sending emails.

CssToInlineStyles class Installation CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline style

YCOM Impersonate. Login as selected YCOM user 🧙‍♂️in frontend.

YCOM Impersonate Login as selected YCOM user in frontend. Features: Backend users with admin rights or YCOM[] rights, can be automatically logged in v

Run your WP site on github pages, php innovation award winner  https://www.phpclasses.org/package/12091-PHP-Make-a-WordPress-site-run-on-GitHub-pages.html
Run your WP site on github pages, php innovation award winner https://www.phpclasses.org/package/12091-PHP-Make-a-WordPress-site-run-on-GitHub-pages.html

Gitpress Run wordpress directly on github pages Gitpress won the innovation award for may 2021 Read more about this https://naveen17797.github.io/gitp

Blackfire Player is a powerful Web Crawling, Web Testing, and Web Scraper application. It provides a nice DSL to crawl HTTP services, assert responses, and extract data from HTML/XML/JSON responses.

Blackfire Player Blackfire Player is a powerful Web Crawling, Web Testing, and Web Scraper application. It provides a nice DSL to crawl HTTP services,

A Native PHP MVC With Auth. If you will build your own PHP project in MVC with router and Auth, you can clone this ready to use MVC pattern repo.

If you will build your own PHP project in MVC with router and Auth, you can clone this ready to use MVC pattern repo. Auth system is implemented. Works with bootstrap 5. Composer with autoload are implemented too for future composer require.

This is a Native PHP MVC. If you will build your own PHP project in MVC with router, you can clone this ready to use MVC pattern repo.

Welcome to PHP-Native-MVC-Pattern 👋 If you will build your own PHP project in MVC with router, you can clone this ready to use MVC pattern repo. Work

A ready-to-use PHP script for sending Emails with an HTML Template will use a Gmail account as the sender and you will not need any email server. Powered by PHPMailer.
A ready-to-use PHP script for sending Emails with an HTML Template will use a Gmail account as the sender and you will not need any email server. Powered by PHPMailer.

Gmail Email Sender by PHP A ready-to-use PHP script for sending Emails with an HTML Template will use a Gmail account as the sender and you will not n

A simple cache library. Implements different adapters that you can use and change easily by a manager or similar.
A simple cache library. Implements different adapters that you can use and change easily by a manager or similar.

Desarolla2 Cache A simple cache library, implementing the PSR-16 standard using immutable objects. Caching is typically used throughout an applicatito

A simple cache library. Implements different adapters that you can use and change easily by a manager or similar.
A simple cache library. Implements different adapters that you can use and change easily by a manager or similar.

Desarolla2 Cache A simple cache library, implementing the PSR-16 standard using immutable objects. Caching is typically used throughout an applicatito

Beauty and simple Wordpress video player plugin. Powerfull and lite in use.
Beauty and simple Wordpress video player plugin. Powerfull and lite in use.

Sonic Spectre Video Player Beauty and simple Wordpress video player plugin. Powerfull and lite in use. Quick Start: Download plugin from this repo and

If you are beginner in WordPress plugin development or if you want to develop your own store product plugin you use this plugin
If you are beginner in WordPress plugin development or if you want to develop your own store product plugin you use this plugin

hirwa-products-plugin If you are beginner in WordPress plugin development or if you want to develop your own store product plugin you use this plugin

Comments
  • api-your-own-servers giving 500 error

    api-your-own-servers giving 500 error

    Hi there,

    The api-your-own-servers script isnt working anymore, when I check the error logs, this is what I see:

    <tr><td colspan="3" style="background: #ff9999"> <b>HTTP_Request2_LogicException</b>: Invalid cookie: '&lt;!doctype html&gt;
    &lt;html&gt;
     &lt;head&gt;
    &lt;meta charset=&quot;utf-8&quot;&gt;
     &lt;meta name' in <b>/home/server1234/public_html/api/api-for-own-servers/server.php</b> on line <b>76</b></td></tr>
    <tr><td colspan="3" style="background-color: #aaaaaa; text-align: center; font-weight: bold;">Exception trace</td></tr>
    <tr><td style="text-align: center; background: #cccccc; width:20px; font-weight: bold;">#</td><td style="text-align: center; background: #cccccc; font-weight: bold;">Function</td><td style="text-align: center; background: #cccccc; font-weight: bold;">Location</td></tr>
    <tr><td style="text-align: center;">0</td><td>HTTP_Request2->addCookie()</td><td>/home/server1234/public_html/api/api-for-own-servers/server.php:76</td></tr>
     <tr><td style="text-align: center;">1</td><td>Server->set_cookie_bypass()</td><td>/home/server1234 in /home/server1234/public_html/api/api-for-own-servers/HTTP/Request2.php on line 558
    
    

    any idea?

    opened by Superion03 19
  • Pornhub mp4 links not reachable(Unauthorized)

    Pornhub mp4 links not reachable(Unauthorized)

    Hi there,

    The return values of Pornhub are not reachable, whenever i try to open one of the mp4 urls that i get back, I see:"Unauthorized We're sorry, the request requires user authentication".

    If I compare your output of the mp4 URL with mine I see the following

    • validfrom= and validto= parameters are diffrent from yours and mine
    • In my mp4 url the ip= parameter is included
    • And the hash= parameter is diffrent fro yours and mine

    Here an example of the API output from your server: https://ev.phncdn.com/videos/202108/13/392894661/1080P_8000K_392894661.mp4?validfrom=1643180690&validto=1643187890&rate=500k&burst=1400k&ipa={YOUR_SERVER_IP}&hash=77z0E0YMwyem74WXDaaZp8kgWAE%3D

    and this is my output i get from the api running on my server https://ev.phncdn.com/videos/202108/13/392894661/1080P_8000K_392894661.mp4?validfrom=1643181735&validto=1643188935&rate=500k&burst=1400k&ip={MY_SERVER_IP}&ipa={MY_SERVER_IP}&hash=nGiYZPZzM0N2MiFZjqbd2AoAiEY%3D

    Any idea whats going wrong, has my server IP been blocked for the Pornhub CDN network? Or is there something else wrong? Btw, xvideos is working very good!

    Kind regards,

    opened by Superion03 8
  • Help

    Help

    Warning: require_once(PEAR/Exception.php): failed to open stream: No such file or directory in /www/wwwroot/sv1.telorku.xyz/v/api/HTTP/Request2/Exception.php on line 24

    Fatal error: require_once(): Failed opening required 'PEAR/Exception.php' (include_path='.:') in /www/wwwroot/sv1.telorku.xyz/v/api/HTTP/Request2/Exception.php on line 24

    in my hosting sir

    opened by dadang223 0
  • high is empty

    high is empty

    hello i hope you are fine its don't got the high url. its empty

    https://appsdev.cyou/xv-ph-rt/api/?site_id=xvideos&video_id=69701791 https://mysite.com/src/?site_id=xvideos&video_id=69701791

    {"hls":{"all":"https:\/\/cdn77-vid.xvideos-cdn.com\/a6eaFEfITMQLskye-cuN-w==,1652983906\/videos_new\/hls\/58\/ac\/e7\/58ace7c6a2389d718ba32e383bc7fe5e\/hls.m3u8"},"mp4":{"high":"","low":"https:\/\/cdn77-vid-mp4.xvideos-cdn.com\/ixei7GIL5gWzr9TdZmb8Dg==,1652983907\/videos_new\/3gp\/5\/8\/a\/xvideos.com_58ace7c6a2389d718ba32e383bc7fe5e.mp4?ui=MTg1LjM3LjIzMS4xMTItL2VtYmVkZnJhbWUvNjk3MDE3OTE_cj0xNjUyOTcz"},"thumb":"https:\/\/cdn77-pic.xvideos-cdn.com\/videos_new\/thumbs169lll\/58\/ac\/e7\/58ace7c6a2389d718ba32e383bc7fe5e\/58ace7c6a2389d718ba32e383bc7fe5e.6.jpg","thumbnails":"https:\/\/appsdev.cyou\/xv-ph-rt\/api\/vtt\/eHZpZGVvc3h4eHh4eHh4eIQuPOZKjQDosFrBVWNZOX1KtJt9dZbonjIEXI50IzTCrzqFJoAHlahbZQvC2DdXp9BC04vYf6iFb9Z3AC9b_RUs-NqT1cHVmhG0z_73p4_xnRn3bwqhoslUv-Mg9LTHA3vvQ0KyFKy1MweqoT8N4J1adsqyyoQCw1BkauMeKFQUcVk-K1GeyCY7fH5ymjq4OcodSPuJzhjMQTW8Jriv6FhS5PR7_d9ElgH5MXwGUmt77_oY8WSpRCsYDJWTW9dzJbj6YL5xCEUgXlYunjM-N4fLflsKXjZn3nKJSXul1ZVSoNpyDiwuYOsApXU3YFw_Nfqw7oBF0RdhZ32cPjn1qH6C-8coP4VqtSXDVW1D6ndE"}

    opened by khldb 2
Get info from any web service or page

Embed PHP library to get information from any web page (using oembed, opengraph, twitter-cards, scrapping the html, etc). It's compatible with any web

Oscar Otero 1.9k Jan 1, 2023
A small example of crawling another website and extracting the required information from it to save the website wherever we need it

A small example of crawling another website and extracting the required information from it to save the website wherever we need it Description This s

Mohammad Qasemi 9 Sep 24, 2022
Simple and fast HTML parser

DiDOM README на русском DiDOM - simple and fast HTML parser. Contents Installation Quick start Creating new document Search for elements Verify if ele

null 2.1k Dec 30, 2022
It can Scrap ZEE5 Live Streaming URL's Using The Channel ID and Direct Play Anywhere

It can Scrap ZEE5 Live Streaming URL's Using The Channel ID and Direct Play Anywhere

Techie Sneh 21 Nov 19, 2021
A browser testing and web crawling library for PHP and Symfony

A browser testing and web scraping library for PHP and Symfony Panther is a convenient standalone library to scrape websites and to run end-to-end tes

Symfony 2.7k Dec 31, 2022
📦✂️📋📦 Create a mirror of packagist.org metadata for use locally with composer

?? Packagist Mirror ❤️ Recommended by packagist.org ❤️ Announcement: Composer 2 is now available! This mirror is for Composer 1; Composer 2 is very fa

Webysther Nunes 175 Dec 30, 2022
A configurable and extensible PHP web spider

Note on backwards compatibility break: since v0.5.0, Symfony EventDispatcher v3 is no longer supported and PHP Spider requires v4 or v5. If you are st

Matthijs van den Bos 1.3k Dec 28, 2022
A program to scrape online web-content (APIs, RSS Feeds, or Websites) and notify if search term was hit.

s3n Search-Scan-Save-Notify A program to scrape online web-content (APIs, RSS Feeds, or Websites) and notify if search term was hit. It is based on PH

Aamer 11 Nov 8, 2022
Crawlzone is a fast asynchronous internet crawling framework aiming to provide open source web scraping and testing solution.

Crawlzone is a fast asynchronous internet crawling framework aiming to provide open source web scraping and testing solution. It can be used for a wide range of purposes, from extracting and indexing structured data to monitoring and automated testing. Available for PHP 7.3, 7.4, 8.0.

null 68 Dec 27, 2022
Library for Rapid (Web) Crawler and Scraper Development

Library for Rapid (Web) Crawler and Scraper Development This package provides kind of a framework and a lot of ready to use, so-called steps, that you

crwlr.software 60 Nov 30, 2022