Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.90 KB | None | 0 0
  1. struct seeds {
  2. let encodedSingnature : String
  3. let seed1 : String
  4. let seed2 : String
  5. }
  6.  
  7. struct openload {
  8.  
  9. static func seedsAnalizer(link: String, completion: @escaping (seeds)->()) {
  10. var fixedLink = link
  11. if link.contains("oload.tv") {
  12. fixedLink = fixedLink.replacingOccurrences(of: "https://oload.tv/embed/", with: "https://openload.co/embed/")
  13. }
  14. print(fixedLink)
  15. Alamofire.request(fixedLink).responseString { response in
  16. print(response.response?.statusCode)
  17. if let content: String = response.result.value {
  18. if response.response?.statusCode == 200 {
  19. do {
  20.  
  21. let doc: Document = try SwiftSoup.parse(content)
  22. if !content.contains("It maybe got deleted by the owner or was removed due a copyright violation") {
  23. let encodedSingnature = try doc.select("p").after("<div class=\"\" style=\"display:none;\">").text().replacingOccurrences(of: " 640K ought to be enough for anybody", with: "")
  24. let seed1 = content.components(separatedBy: "_0x30725e,")[1].components(separatedBy: "),_1x4bfb36)")[0]
  25. let seed2 = content.components(separatedBy: "_1x4bfb36=")[1].components(separatedBy: ";")[0]
  26. completion(seeds(encodedSingnature: encodedSingnature, seed1: seed1, seed2: seed2))
  27. }
  28.  
  29. } catch {
  30.  
  31. print("error")
  32. }
  33.  
  34. } else {
  35.  
  36. print("error need bypass")
  37. print(response.response?.statusCode as Any)
  38.  
  39. } // If status code is different 200
  40. } // First If
  41. } // Alamofire
  42. } // Func
  43.  
  44. static func generateLinks(seeds: seeds, completion: @escaping (mp4Links)->()) {
  45.  
  46. print(seeds)
  47.  
  48. let encodeSingatureStart = seeds.encodedSingnature.prefix(72)
  49. let encodeSingatureEnds = seeds.encodedSingnature.replacingOccurrences(of: encodeSingatureStart, with: "")
  50.  
  51. var ivArray = [Int]()
  52. var i = 0
  53. var signature = ""
  54.  
  55. while i < encodeSingatureStart.count {
  56. let startIndex = i
  57. let endIndex = i + 8
  58. let start = String.Index(utf16Offset: startIndex, in: encodeSingatureStart)
  59. let end = String.Index(utf16Offset: endIndex, in: encodeSingatureStart)
  60. let iv = String(encodeSingatureStart[start..<end]) // This could be wrong
  61. ivArray.append(Int(iv, radix: 16) ?? 0)
  62.  
  63. i = i + 8
  64. }
  65.  
  66. var iv_index = 0
  67. var x = 0
  68.  
  69. while x < encodeSingatureEnds.count {
  70.  
  71. var unknown_2 = 0
  72. var unknown_3 = 0
  73. var unknown_4 = 0
  74.  
  75. repeat {
  76.  
  77. let startIndex = x
  78. let endIndex = x + 2
  79. let start = String.Index(utf16Offset: startIndex, in: encodeSingatureEnds)
  80. let end = String.Index(utf16Offset: endIndex, in: encodeSingatureEnds)
  81.  
  82. let unknown_5 = String(encodeSingatureEnds[start..<end]) // This could be wrong
  83.  
  84. unknown_4 = Int(unknown_5, radix: 16) ?? 0
  85.  
  86. let unknown_6 = unknown_4 & 63
  87.  
  88. if unknown_3 < 30 {
  89. unknown_2 = unknown_2 + unknown_6 << unknown_3
  90. } else {
  91. unknown_2 = unknown_2 + unknown_6 * Int(pow(Double(2), Double(unknown_3)))
  92. print(unknown_2)
  93. }
  94.  
  95. unknown_3 = unknown_3 + 6
  96.  
  97. x = x + 2
  98.  
  99. } while unknown_4 >= 64
  100.  
  101. var IV = unknown_2 ^ ivArray[iv_index % 9]
  102. IV = (IV ^ Int(seeds.seed2)!) ^ Int(seeds.seed1)!
  103.  
  104. var unknown_8 = 255
  105. var j = 0
  106.  
  107. while j < 4 {
  108.  
  109. let charcode = ((IV & unknown_8) >> (8 * j)) - 1
  110. let character = String(UnicodeScalar(UInt8(charcode))) // Could be wrong
  111.  
  112. if character != "$" {
  113. signature = signature + character
  114. print(signature)
  115. }
  116.  
  117. unknown_8 = unknown_8 << 8
  118. j = j + 1
  119. }
  120.  
  121. iv_index = iv_index + 1
  122. }
  123. print("https://openload.co/stream/" + signature)
  124.  
  125. completion(mp4Links(link: "https://openload.co/stream/" + signature))
  126.  
  127. } // Func
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement