cm api

node v10.24.1
version: 1.0.0
endpointsharetweet
var Xray = require('x-ray'); var mongoose = require('mongoose') const bodyParser = require('body-parser') const express = require("@runkit/ego/express-app/1.0.0") const app = express(module.exports); const base = 'https://channelmyanmar.org/?s='; const baseUrl = 'https://channelmyanmar.org/movies/'; const pageUrl = 'https://channelmyanmar.org/movies/page/'; const thisUrl = 'https://untitled-d7a4ca7dqc5s.runkit.sh/'; const x = Xray({ filters: { regex: function(value) { return typeof value === 'string' ? value.replace(/(\(.*?\))/g, '') : value }, replace: function(value) { return typeof value === 'string' ? value.replace('https://channelmyanmar.org/', thisUrl+'api/movie/') : value }, movieid: function(value) { return typeof value === 'string' ? value.replace('https://channelmyanmar.org/', '') : value }, number: function(value) { return typeof value === 'string' ? Number(value.replace(/\D+/g,'')) : value }, category: function(value) { if (typeof value === 'string') { let refine = value.replace('https://channelmyanmar.org/category/', thisUrl); let refine2 = refine ; return refine; } }, catId: function(value) { if (typeof value === 'string') { let refine = value.replace('https://channelmyanmar.org/category/', ''); let refine2 = refine.replace('/','') ; return refine2; } }, fix2: function(value) { if (typeof value === 'string') { let refine = Number(value) + 1; let refine2 = thisUrl+"page/" +refine; return refine2; } }, yadi: function(value) { if (typeof value === 'string') { if (value.includes("https://yadi.sk")){ // var url = getUrl(value); return value; } return ; } }, yadiId: function(value) { return typeof value === 'string' ? value.replace('https://yadi.sk/i/', '') : value }, mega: function(value) { if (typeof value === 'string') { if (value.includes("https://mega.nz/")){ var url = value.replace("https://mega.nz/file", "https://mega.nz/embed"); return url; } return ; } }, host: function(value) { if (typeof value === 'string') { var url = value.replace("https://", "").trim(); //url = url.split(".")[0]; if (url.includes("Soliddrive.co")) { url = "SolidDrive"; } else if (url.includes("drive.google.com")) { url = "Myandrive"; } else if (url.includes("disk.yandex.com")) { url = "Yandex" ; } else if (url.includes("mirrorace")) { url = "Mirrorace"; } else if (url.includes("fastload")) { url = "Fastload"; } else if (url.includes("megaup")) { url = "MegaUp"; } else if (url.includes("mega")) { url = "MeGa"; }else if (url.includes("1fichier.com")) { url = "1Fichier"; }else if (url.includes("upstream.to")) { url = "Upstream"; }; return url; } } } });
// function xurlx (xx){ x('https://channelmyanmar.org/the-banker2020/', { link : '#slider1 > div > div > div:nth-child(1) > div > span.ttps', }) (function(err, obj) { console.log(obj) }) // } // xurlx('https://channelmyanmar.org/page/13');
app.get('/', function(req, res) { var id = req.query.id; res.send("Welcome"); }); app.get('/category', function(req, res) { var stream = x(baseUrl, '#moviehome .cat-item',[{ title: 'a', id: 'a@href | catId', thispage: 'a@href | category', count : 'span | number', }]) .stream() stream.pipe(res) }); app.get('/category/:name/page/:page', function(req, res) { var page = req.params.page; var name = req.params.name; var xurl = 'https://channelmyanmar.org/category/'+name+'/page/'+page; stream = x(xurl, { title: 'title', thispage: '.paginado ul li.dd a | number', totalCount: '.paginado ul li:last-child a@href | number', nextpage: '.paginado ul li.dd a | fix2', totalpage: '.paginado ul li:last-child a@href', results: x('.peliculas .items .item', [{ id: '@id | number', quality: '.calidad2', title: '.image img@alt | regex', rate: '.imdbs', type: '.typepost', year: '.image img@alt | number',//'.fixyear .year', link: ' a@href | movieid', img: '.image img@src', details: x('a@href', { title: 'h1 | regex', // description: 'a@href', category: 'i.limpiar', uploadDate: 'meta[itemprop="uploadDate"]@content', embedUrl: 'meta[itemprop="embedUrl"]@content', director: '#single div[itemprop="director"] meta@content', actors: x('div[itemprop="actors"]', ['meta[itemprop="name"]@content']), gallary: x('div.galeria_img', ['img@src']), download: x('li.elemento', [{ size: '.c', site: '.b | host', quality: '.e', url: 'a@href' }]), mega: x('li.elemento', [{ url: 'a@href | mega' }]), yadi: x('li.elemento', [{url: 'a@href | yadi', id:'a@href | yadi |yadiId'}]), }) }]) }) .stream() stream.pipe(res) }); // app.get('/category/:name/page/:page', function(req, res) { // let catUrl = 'https://channelmyanmar.org/category/'; // var name = req.params.name, // page = req.params.page, // url = catUrl + name + '/page/' + page; // var stream = x(url, { // title: 'title', // thispage: '.paginado ul li.dd a | number', // totalCount: '.paginado ul li:last-child a@href | number', // nextpage: '.paginado ul li.dd a | next', // totalpage: '.paginado ul li:last-child a@href', // data: x('.peliculas .items .item', [{ // id: '@id | number', // quality: '.calidad2', // title: '.image img@alt', // }]) // }).stream() // stream.pipe(res); // // res.send(url) // });
app.get('/api/movie/:id', function(req, res) { let cmUrl = 'https://channelmyanmar.org/?p='; let id = req.params.id ; let url = cmUrl+id var stream = x(url, { title: 'h1 | regex', description: '#cap1 p', category: 'i.limpiar', uploadDate: 'meta[itemprop="uploadDate"]@content', embedUrl: 'meta[itemprop="embedUrl"]@content', director: '#single div[itemprop="director"] meta@content', actors: x('div[itemprop="actors"]', ['meta[itemprop="name"]@content']), gallary: x('div.galeria_img', ['img@src']), download: x('li.elemento', [{ size: '.c', site: '.b | host', quality: '.e', url: 'a@href' }]), mega: x('li.elemento', [{ url: 'a@href | mega' }]), yadi: x('li.elemento', [{title: 'a@href | yadi'}]), relate: x('#slider1 div div',[{ link:'a@href', title: 'img@alt', img:'img@src'}]) }) .stream() stream.pipe(res) }); app.get('/movie', function(req, res) { let url = req.query.url var stream = x(url, { title: 'h1 | regex', description: '#cap1 p', category: 'i.limpiar', uploadDate: 'meta[itemprop="uploadDate"]@content', embedUrl: 'meta[itemprop="embedUrl"]@content', director: '#single div[itemprop="director"] meta@content', actors: x('div[itemprop="actors"]', ['meta[itemprop="name"]@content']), gallary: x('div.galeria_img', ['img@src']), download: x('li.elemento', [{ size: '.c', site: '.b | host', quality: '.e', url: 'a@href' }]), mega: x('li.elemento', [{ url: 'a@href | mega' }]), yadi: x('li.elemento', [{title: 'a@href | yadi'}]), relate: x('#slider1 div div',[{ link:'a@href', title: 'img@alt', img:'img@src'}]) }) .stream() stream.pipe(res) });
app.get('/api', function(req, res) { var page = req.query.url ; var id = req.params.id; var _next = id+1 var url = pageUrl+id|| baseUrl; var stream = x(baseUrl, { title: 'title', thispage: '.paginado ul li.dd a | number', totalCount : '.paginado ul li:last-child a@href | number', nextpage: '.paginado ul li.dd a | fix2', totalpage: '.paginado ul li:last-child a@href', data: x('.peliculas .items .item', [{ id: '@id | number', quality: '.calidad2', title: '.image img@alt', rate: '.imdbs', type: '.typepost', year: '.fixyear .year', link: ' a@href', img: '.image img@src', }]) }) .stream() stream.pipe(res) }) app.get('/search', function(req, res) { var page = req.query.s ; var id = req.params.id; var _next = id+1 var url = base + encodeURI(page); //res.send(url); var stream = x(url, { title: 'title', thispage: '.paginado ul li.dd a | number', totalCount : '.paginado ul li:last-child a@href | number', //nextpage: '.paginado ul li.dd a | fix2', // totalpage: '.paginado ul li:last-child a@href', data: x('.peliculas .items .item', [{ id: '@id | number', quality: '.calidad2', title: '.image img@alt', rate: '.imdbs', type: '.typepost', year: '.fixyear .year', link: ' a@href', img: '.image img@src', }]) }) .stream() stream.pipe(res) })
app.get('/api/page/:id', function(req, res) { var page = pageUrl + req.params.id , stream = x(page || baseUrl, { title: 'title', thispage: '.paginado ul li.dd a | number', totalCount: '.paginado ul li:last-child a@href | number', nextpage: '.paginado ul li.dd a | fix2', totalpage: '.paginado ul li:last-child a@href', results: x('.peliculas .items .item', [{ id: '@id | number', quality: '.calidad2', title: '.image img@alt | regex', rate: '.imdbs', type: '.typepost', year: '.image img@alt | number',//'.fixyear .year', link: ' a@href | movieid', img: '.image img@src', details: x('a@href', { title: 'h1 | regex', // description: 'a@href', category: 'i.limpiar', uploadDate: 'meta[itemprop="uploadDate"]@content', embedUrl: 'meta[itemprop="embedUrl"]@content', director: '#single div[itemprop="director"] meta@content', actors: x('div[itemprop="actors"]', ['meta[itemprop="name"]@content']), gallary: x('div.galeria_img', ['img@src']), download: x('li.elemento', [{ size: '.c', site: '.b | host', quality: '.e', url: 'a@href' }]), mega: x('li.elemento', [{ url: 'a@href | mega' }]), yadi: x('li.elemento', [{url: 'a@href | yadi', id:'a@href | yadi |yadiId'}]), }) }]) }) .stream(); stream.pipe(res) });
const axios = require("axios"); const cheerio = require('cheerio'); const fetchCm = async(reqUrl) => { const result = await axios.get(reqUrl); return cheerio.load(result.data); }; const getData = async(i) => { var videos = { 'title':'', 'data':[]}; const $ = await fetchCm(i); let name = $('script#store-prefetch').text(); var json = JSON.parse(name); var jsonId = json.rootResourceId; videos.title = json[jsonId].name; //console.log(json.resources[jsonId].videoStreams.videos); var m3u = json.resources[jsonId].videoStreams.videos; videos.data.push(m3u); console.log(videos); return videos; }; function getUrl(domain) { const request = axios.get(domain); request.then(result => { var videos = { 'title':'', 'data':[]}; var $ = cheerio.load(result.data); var ini = $("script[type='application/json']").text(); var _json = JSON.parse(ini); var json = _json.rootResourceId let data = _json.resources; videos.title = data[json].name; var m3u= data[json].videoStreams.videos; videos.data.push(m3u); console.log(videos); return videos; }); return request; } getUrl('https://yadi.sk/i/Kw-NFOAcM70v_w'); var sample =getData('https://yadi.sk/i/Kw-NFOAcM70v_w'); console.log(sample);
app.get('/yadi', function(req, res) { var url = req.query.url; var sample =axios.get(url); sample.then(result => { var videos = 'https://egohub.github.io/watch/?video='; var $ = cheerio.load(result.data); var ini = $("script[type='application/json']").text(); var _json = JSON.parse(ini); var json = _json.rootResourceId let data = _json.resources; var m3u = data[json].videoStreams.videos; res.send(m3u); }); // res.set('Content-Type', 'text/html') // res.send(Buffer.from('<h3>some html</h3> ' // +'<iframe > </iframe>' // )) });
let rp = require('request'); app.get('/stream', (req, resp) => { var url = req.query.url; var regex = /https:\/\/(.*?).mp4/g; rp(url, (err,ress, body) => { let title ; let $ = cheerio.load(body , {xmlMode: true}); let str = $('body').html() let m = regex.exec(str) resp.redirect(m[0]) //resp.json({"url": m[0]}) }); });
app.get('/upstream', function(req, res) { var url = req.query.url; //var embed = url.split('.to/')[1]; rp(url, function(error, response, body) { let $ = cheerio.load(body); let results = {}; let str = $('body').html(); let regex = /https:\/\/[\S]+?\.mp4/g; let m = regex.exec(str) console.log(m[0]); results.url = m[0]; results.embed = url//'https://upstream.to/embed-'+embed+'.html'; results.watch = 'https://egohub.github.io/video/?video=' + m[0]; res.send(results); // res.redirect(results.watch) }); });
Loading…

no comments

    sign in to comment