import Foundation
let pattern = #"(?siU)var tc = '([a-zA-Z0-9]*)'(?:.*)_token": "([\w]*)"(?:.*)slice\(([\d,]*)\)"#
let regex = try! NSRegularExpression(pattern: pattern, options: .anchorsMatchLines)
let testString = ##"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" type="image/x-icon" href="https://123moviesplayer.com/public/images/favicon.png">
<meta name="robots" content="noindex">
<title>The Good Doctor - PutStream</title>
<meta name="title" content="The Good Doctor - PutStream"/>
<meta name="description" content=" - PutStream"/>
<meta property="og:title" content="The Good Doctor - PutStream"/>
<meta property="og:description" content=" - PutStream"/>
<meta property="og:keywords" content=" - PutStream"/>
<meta property="og:image:height" content="350"/>
<meta property="og:image:width" content="650"/>
<meta property="og:image" content=""/>
<link href="https://123moviesplayer.com/dsPlayer/player.css" rel="stylesheet">
<script data-cfasync="false" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script data-cfasync="false" type="text/javascript" src="//puntoenun.site/rm4hSvDnGTSHIK8G/14151"></script>
<script data-cfasync="false" src="//d10lv7w3g0jvk9.cloudfront.net/?gwvld=813639"></script>
</head>
<body>
<div class="custom_loading_sign">
<img src="https://123images.co/curved-bars.svg" alt="">
</div>
<style>
.custom_loading_sign {background: #000 none repeat scroll 0 0; bottom: 0; left: 0; position: fixed; right: 0; text-align: center; top: 0; z-index: 99; }
.custom_loading_sign img {margin-top: -50px; margin-left: -50px; position: absolute; top: 50%; width: 100px; }
.cantskip {
bottom: 0%;
position: absolute;
right: 0%;
}
.adtimes {
bottom: 0%;
position: absolute;
left: 20%;
}
#timer {
right: 5px;
position: absolute;
color: white;
}
</style>
<iframe sandbox="allow-same-origin allow-popups allow-scripts allow-popups-to-escape-sandbox" id="openloadIframe" allowfullscreen="" webkitallowfullscreen="true" mozallowfullscreen="true" style="width:100%;height:100%;" src=""></iframe>
<div class="player_area">
<div id="player">
</div>
</div>
<script data-cfasync="false">
function openNew(links,mirror){
if(!mirror){ mirror = 'mirror4';}
$('.checkresume.clear').remove();
addRemoveClas(mirror);
$("div").removeClass("player_area");
$('#openloadIframe').attr('src', links);
}
function addRemoveClas(miror){
$(".alternativer ul li").removeClass('select-hold');
$(".alternativer ul li[data-value='"+miror+"']").addClass('select-hold');
}
function initializLinks(put_links){
if(put_links[0] != -1){
openNew(put_links[0].file,'mirror1');
}else if(put_links[1] != -1){
openNew(put_links[1].file,'mirror2');
}else if(put_links[2] != -1){
openNew(put_links[2].file,'mirror3');
}else if(put_links[3] != -1){
openNew(put_links[3].file,'mirror4');
}else if(put_links[4] != -1){
openNew(put_links[4].file,'mirror5');
}else{
alert("no source available. please try after sometime!!");
}
}
function initializePlayer(links){
var put_links= [];
var opn = false;
var mirros = [];
var cn = 0;
var links = jQuery.parseJSON(links);
if(links.length!=0){
for (i = 0; i < links.length; ++i) {
var getLinks = links[i];
if (getLinks.trim()) {
//console.log(getLinks);
if (/gounlimited/i.test(getLinks)) {
var singleSrc={};
singleSrc.file=links[i];
singleSrc.label='gounlimited';
singleSrc.type='mp4';
}else if (/\/vid\//i.test(getLinks)) {
var singleSrc={};
singleSrc.file=links[i];
singleSrc.label='vid';
singleSrc.type='mp4';
}else if (/\/vid1\//i.test(getLinks)) {
var singleSrc={};
singleSrc.file=links[i];
singleSrc.label='vid1';
singleSrc.type='hls';
singleSrc.default=false;
}else if (/onlystream/i.test(getLinks)) {
var singleSrc={};
singleSrc.file=links[i];
singleSrc.label='onlystream';
singleSrc.type='mp4';
}else if (/vcstream/i.test(getLinks)) {
var singleSrc={};
singleSrc.file=links[i];
singleSrc.label='vcstream';
singleSrc.type='mp4';
}else if (/mightyupload/i.test(getLinks)) {
var singleSrc={};
singleSrc.file=links[i];
singleSrc.label='mightyupload';
singleSrc.type='mp4';
}else if (/upstream/i.test(getLinks)) {
var singleSrc={};
singleSrc.file=links[i];
singleSrc.label='upstream';
singleSrc.type='mp4';
}else if (/hqq.tv/i.test(getLinks)) {
var singleSrc={};
singleSrc.file=links[i];
singleSrc.label='hqqtv';
singleSrc.type='mp4';
}else if (/mightyupload/i.test(getLinks)) {
var singleSrc={};
singleSrc.file=links[i];
singleSrc.label='mightyupload';
singleSrc.type='mp4';
}else {
var singleSrc={};
singleSrc.file=links[i];
singleSrc.label='gl';
singleSrc.type='mp4';
}
if(singleSrc == -1){
mirros[i+1] = -1;
put_links[cn] = -1; cn++;
}else{
put_links.push(singleSrc);
mirros[i+1] = cn; cn++;
}
}else{
mirros[i+1] = -1;
put_links[cn] = -1; cn++;
}
}
}
if(opn){
//openNew(opn,'mirror1');
}else{
initializLinks(put_links);
}
}
$(document).ready(function(){
$('.custom_loading_sign').hide();
// $('.adtimes').hide();
linksgeter();
});
function linksgeter(){
//$('.adtimes').show();
//$('.app-download').hide();
//$('.skipads').hide();
// document.getElementById('timer').innerHTML = 00 + ":" + 30;
/// startTimer();
//$('.cantskip').hide();
//$('#`player1`').hide();
//$('#adshow').hide();
$('#openloadIframe').show();
$('.player_area').show();
//$('.alternativer').height($('.alternativer ul').height());
$('.custom_loading_sign').show();
var tc = 'bXFXbW9hVnJZV0Nub2FXbHBKYVRubUNsb1dDWG5wU1dsbDVrbUtsa21XUm9ZNmVVcUpKZ21hYWVucTJhcGFhaHBXdGhZR05qWlo2aHA1dVdwYUdla3F1V3BGK1ZvSjlncUpxV1lKZXFmR0dYaVhTZGU1dWhtcFo1aTVwK2RIeXJlNXVobW45MWY1cCtkSHlkZTV1aG1uK0ZmNXArZEh5aGxJaURtb0dhZkdHV2RZdGhnS3R6WVlDcm1acCtkSHlYZTV1aG1vQ0ZlNnQvbTVsamdJV0RZNENiaDJXQWhYZXJnWFdIWW51YXFacVdlR3VqaklobW1vR2FlMlovcTROaGdJV1ptcGlDWGwxWW42R2ZsNWFmazY2dG1xV21vYVZyWVdDYW9xTmZwcWRob1o2U3E1YWtZSmVlbEphV2tLS2RrNnFYbzJDaG1xRnhwNXVWYjRpZWc2S0dkNWlzaXArcGZvS3NlMmFFZG9PZGxXV0xlbjU2YzZlQ2htRnJWNU9tcHFDaW5aT3FiNStoclE9PQ';
$.ajax({
type: "POST", url: "https://123moviesplayer.com/decoding_v3.php",
headers: { 'x-token': _tsd_tsd_ds(tc)},
data: {
'tokenCode': tc,
"_token": "lV3wAUeCfrSK80dAP3N2ge2pojJJrOcrjrWl2o9C",
},
success: function(put_links) {
$('.custom_loading_sign').hide();
initializePlayer(put_links);
}
});
}
function _tsd_tsd_ds(s) { var _76x80l = s;var _61rxx129 = _76x80l.slice(9,28);var _520fx33 = _39x759d(_61rxx129); var _1x70n = _O88xO4(_520fx33); return _12vx90(_1x70n) + "28"+"939459"; } function _39x759d(s){return s.split("");}function _O88xO4(r){return r.reverse();}function _12vx90(n){return n.join("");}</script>
<style>
body,html{background-color: #000;}
.player_area {bottom: 0 !important; left: 0; position: absolute; right: 0; top: 0; }
.jwplayer.jw-flag-aspect-mode {height: 100% !important; }
.jwplayer#player, body .jw-error {height: 100% !important; width: 100% !important; }
.jw-icon.jw-icon-tooltip.jw-icon-cc.jw-reset.jw-hidden {display: inline-block !important; }
</style>
<!-- upload custome subtitles -->
<script data-cfasync="false" src="https://123moviesplayer.com/dsPlayer/dropzone.js"></script>
<script data-cfasync="false">
$("<div class='alternativer'></div>").appendTo($("body"));
$(".alternativer").html('<span></span><ul><li class="select-hold" data-value="mirror1" onclick="changeSource(\'mirror1\'); return false">Mirror 1</li><li class="" data-value="mirror2" onclick="changeSource(\'mirror2\'); return false">Mirror 2</li><li class="" data-value="mirror3" onclick="changeSource(\'mirror3\'); return false">Mirror 3</li><li class="" data-value="mirror4" onclick="changeSource(\'mirror4\'); return false">Mirror 4</li><li class="" data-value="mirror5" onclick="changeSource(\'mirror5\'); return false">Mirror 5</li></ul>');
if($("iframe").length==0) {
$(".alternativer ul").fadeIn()
}else $(".alternativer").css( { right:4,top:16 });
$(".alternativer span").click(function(){
$(".alternativer ul").fadeToggle()
}
);
$(".vjs-tech").click(function() {
$('.alternativer ul').hide();
}
);
$(".vjs-poster").click(function() {
$('.alternativer ul').hide();
}
);
$('.alternativer ul li').click(function() {
$("*").removeClass("select-hold");
$(this).addClass('select-hold')
}
);
function changeSource(sourceIndex){
var currentmovieHerf='https://123moviesplayer.com/show/the-good-doctor/03-13?src='+sourceIndex;
window.location.replace(currentmovieHerf); return false;
}
$(document).ready(function(){
//$('.alternativer').height($('.alternativer ul').height());
});
</script>
<style>
.alternativer ul li:hover, .alternativer ul li.select-hold {color: red; }
.alternativer {max-height: 160px; position: absolute; right: 15px; bottom: 225px; width: 110px; z-index: 999999 !important; }
.alternativer span {background: rgba(0, 0, 0, 0.55) none repeat scroll 0 0; border-radius: 0; box-shadow: 0 0 3px 1px #cfcbcb; cursor: pointer; display: block; float: right; height: 100%; opacity: 1; position: relative; text-align: center; width: 15px; z-index: 99; }
.alternativer ul {background: rgba(0, 0, 0, 0.55) none repeat scroll 0 0; color: #979797; float: left; font-size: 13px; left: 0; list-style-type: none; margin: 0; padding: 0; position: absolute; top: 0; width: 145px; }
.alternativer ul li {border-bottom: 1px solid red; border-radius: 0; box-sizing: border-box; color: #fff; cursor: pointer; font-size: 14px; font-style: normal; line-height: 16px; margin: 0; max-height: 36px; opacity: 0.9; padding: 5px 10px; text-align: left; width: 100%; }
.alternativer span::before {color: red; content: ">"; display: block; font-size: 12px; height: 10px; left: 1px; margin-top: -6px; opacity: 1; position: absolute; top: 50%; width: 100%; }
.vjs-control-bar{z-index: 99999999999999999999;}
</style>
<!-- Histats.com START (aync)-->
<script type="text/javascript">var _Hasync= _Hasync|| [];
_Hasync.push(['Histats.start', '1,2793971,4,0,0,0,00010000']);
_Hasync.push(['Histats.fasi', '1']);
_Hasync.push(['Histats.track_hits', '']);
(function() {
var hs = document.createElement('script'); hs.type = 'text/javascript'; hs.async = true;
hs.src = ('//s10.histats.com/js15_as.js');
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(hs);
})();</script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-153655914-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-153655914-1');
</script>
</body>
</html>
"""##
let stringRange = NSRange(location: 0, length: testString.utf16.count)
let matches = regex.matches(in: testString, range: stringRange)
var result: [[String]] = []
for match in matches {
var groups: [String] = []
for rangeIndex in 1 ..< match.numberOfRanges {
let nsRange = match.range(at: rangeIndex)
guard !NSEqualRanges(nsRange, NSMakeRange(NSNotFound, 0)) else { continue }
let string = (testString as NSString).substring(with: nsRange)
groups.append(string)
}
if !groups.isEmpty {
result.append(groups)
}
}
print(result)
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Swift 5.2, please visit: https://developer.apple.com/documentation/foundation/nsregularexpression