Advertisement
Guest User

generate_strm_files_from_disney.php

a guest
Jan 14th, 2021
3,069
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1. <?php
  2.  
  3. error_reporting(E_ERROR);
  4.  
  5. $input = call_user_func(function(){
  6. $lines = [];
  7. while ($line = fgets(STDIN)) {
  8. $lines[] = $line;
  9. }
  10. return implode("\n", $lines);
  11. });
  12.  
  13. $domDocument = new DomDocument();
  14. $domDocument->preserveWhiteSpace = false;
  15. $domDocument->formatOutput = true;
  16. $domDocument->loadHTML($input);
  17.  
  18. $UUIDv4 = '/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i';
  19.  
  20.  
  21. foreach( $domDocument->getElementsByTagName('div') as $div) {
  22. $uuidOfEpisode = $div->getAttribute('data-gv2key');
  23. if (preg_match($UUIDv4, $uuidOfEpisode)) {
  24. $nodeValue = $div->{"nodeValue"};
  25. preg_match("/^(.*?)\(/",$nodeValue, $title);
  26. if (array_key_exists(1, $title) && preg_match('/^\d.*/', $title[1])) {
  27. $titleOfEpisode = rtrim($title[1], " ");
  28.  
  29. echo "\n";
  30. echo "\n";
  31.  
  32. echo "Found this: ";
  33. echo $uuidOfEpisode;
  34. echo "\n";
  35. echo $titleOfEpisode;
  36. echo "\n";
  37.  
  38.  
  39. $fileContent = "plugin://slyguy.disney.plus/?_=play&amp;_play=1&amp;content_id=$uuidOfEpisode";
  40. $filename = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $titleOfEpisode);
  41. $filename = mb_ereg_replace("([\.]{2,})", '', $filename);
  42. $filename = mb_ereg_replace("(\s)", '_', $filename) . ".strm";
  43. file_put_contents($filename, $fileContent);
  44. }
  45.  
  46. }
  47.  
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement