Advertisement
csetariq

hungama

Nov 30th, 2020
521
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. https://media.hungama.com/c/4/c16/fe4/41239877/41239877_128.mp3?ahC6QJXp689q8mmwtI1ELFoexYmqQtotOrvWb7fX2zyyPw7w266n6CZ7BPpcRABPjBK8ivOlaHRSlCf82YbLzjCadP6mZo2TOPtx3ZkbBNCHg7VRAKNJ5VSvvfgHZISs7Jwzfg
  2.  
  3. https://www.hungama.com/user/downloads
  4.  
  5. content_id=2379437&content_type=song
  6.  
  7. const nodeItems = document.getElementsByClassName('art-ttl');
  8.  
  9. let iterTime = 0;
  10. const inter = 10000;
  11. for (a of nodeItems) {
  12.     const href = a.getAttribute('href');
  13.     if (href.includes('/song/')) {
  14.         const contentId = /https:\/\/www.hungama.com.song\/([^/]+)\/([0-9]+)\//.exec(href)[2];
  15.         console.log(`processing ${contentId}`);
  16.         const formData = new FormData();
  17.         formData.append('content_id', contentId);
  18.         formData.append('content_type', 'song');
  19.         setTimeout(() => {
  20.         $.ajax({
  21.             type: 'POST',
  22.             url: '/user/downloads',
  23.             data: `content_id=${contentId}&content_type=song`,
  24.             processData: false,
  25.             success: (data) => {
  26.                 console.log(data);
  27.                 const response = JSON.parse(data);
  28.                 if (response.stats === 'done') {
  29.                     console.log(`about to download ${response.file_path}`);
  30.                     window.open(response.file_path, '_blank');
  31.                 } else {
  32.                     console.log(`status not done for ${contentId}`);
  33.                 }
  34.             }
  35.         });
  36.         }, iterTime * inter);
  37.         iterTime++;
  38.     }
  39. }
  40.  
  41. for (a of nodeItems) {
  42.     const href = a.getAttribute('href');
  43.     if (href.includes('/song/')) {
  44.         const contentId = /https:\/\/www.hungama.com.song\/([^/]+)\/([0-9]+)\//.exec(href)[2];
  45.         console.log(`processing ${contentId}`);        
  46.     }
  47. }
  48.  
  49. $.ajax({
  50.             type: 'POST',
  51.             url: '/user/downloads',
  52.             data: `content_id=${contentId}&content_type=song`,
  53.             processData: false,
  54.             success: (data) => {
  55.                 console.log(data);
  56.             }
  57.         });
  58.  
  59. $.post('/user/downloads', formData, (data) => {
  60.                 console.log(data);
  61.             });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement