Advertisement
rito_kun

Recuperation musique Japan FM pour node.js (par ex : Twitch)

Apr 20th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Il faut installer le module cheerio
  2. // npm install cheerio
  3.  
  4. cheerio = require('cheerio')
  5.  
  6. var headers = {
  7.             'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36',
  8.             'Content-Type' : 'application/x-www-form-urlencoded'
  9.         }
  10.  
  11.         var url = "http://www.japanfm.fr/player/refresh_dernier_titre-new2.php"
  12.  
  13.         request({url:url, headers: headers}, function(error, response, body){
  14.             if (!error){
  15.                 var $ = cheerio.load(body)
  16.                 console.log($('.div_artiste_player_integ').text())
  17.        
  18.                 client.say("Nom de la chaine", "TwitchLit En cours : " + $('.div_artiste_player_integ').text())
  19.        
  20.             } else { console.log("Ya un ptit probleme : " + error); }
  21.         })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement