# coding=utf8
# the above tag defines encoding for this document and is for Python 2.x compatibility
import re
regex = r"(?siU)var tc = '([a-zA-Z0-9]*)'(?:.*)_token\": \"([\w]*)\"(?:.*)slice\(([\d,]*)\)"
test_str = ("\n"
"<!DOCTYPE html>\n"
"<html lang=\"en\">\n"
"<head>\n"
" <meta charset=\"UTF-8\">\n"
" <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n"
" <link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"https://123moviesplayer.com/public/images/favicon.png\">\n"
" <meta name=\"robots\" content=\"noindex\">\n"
" <title>The Good Doctor - PutStream</title>\n"
" <meta name=\"title\" content=\"The Good Doctor - PutStream\"/>\n"
" <meta name=\"description\" content=\" - PutStream\"/>\n"
" <meta property=\"og:title\" content=\"The Good Doctor - PutStream\"/>\n"
" <meta property=\"og:description\" content=\" - PutStream\"/>\n"
" <meta property=\"og:keywords\" content=\" - PutStream\"/>\n"
" <meta property=\"og:image:height\" content=\"350\"/>\n"
" <meta property=\"og:image:width\" content=\"650\"/>\n"
" <meta property=\"og:image\" content=\"\"/>\n"
" \n\n"
" <link href=\"https://123moviesplayer.com/dsPlayer/player.css\" rel=\"stylesheet\">\n"
" <script data-cfasync=\"false\" type=\"text/javascript\" src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js\"></script>\n\n"
" \n\n\n"
"<script data-cfasync=\"false\" type=\"text/javascript\" src=\"//puntoenun.site/rm4hSvDnGTSHIK8G/14151\"></script>\n"
"<script data-cfasync=\"false\" src=\"//d10lv7w3g0jvk9.cloudfront.net/?gwvld=813639\"></script>\n\n\n\n"
" \n"
"</head>\n"
"<body>\n\n\n\n\n"
"<div class=\"custom_loading_sign\">\n"
" <img src=\"https://123images.co/curved-bars.svg\" alt=\"\">\n"
"</div>\n"
"<style>\n"
".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; }\n"
".custom_loading_sign img {margin-top: -50px; margin-left: -50px; position: absolute; top: 50%; width: 100px; }\n"
".cantskip {\n"
" bottom: 0%;\n"
" position: absolute;\n"
" right: 0%;\n"
"}\n"
".adtimes {\n"
" bottom: 0%;\n"
" position: absolute;\n"
" left: 20%;\n"
"}\n"
"#timer {\n"
" right: 5px;\n"
" position: absolute;\n"
" color: white;\n"
"}\n"
"</style>\n\n\n\n\n\n"
"<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>\n\n"
"<div class=\"player_area\">\n"
" <div id=\"player\">\n"
" \n"
" </div>\n"
" \n"
" \n"
"</div>\n\n\n\n\n"
"<script data-cfasync=\"false\">\n\n\n"
"function openNew(links,mirror){\n"
" if(!mirror){ mirror = 'mirror4';}\n"
" $('.checkresume.clear').remove();\n"
" addRemoveClas(mirror);\n"
" $(\"div\").removeClass(\"player_area\");\n"
" $('#openloadIframe').attr('src', links);\n"
"}\n\n"
"function addRemoveClas(miror){\n"
" $(\".alternativer ul li\").removeClass('select-hold');\n"
" $(\".alternativer ul li[data-value='\"+miror+\"']\").addClass('select-hold');\n"
"}\n\n\n\n"
"function initializLinks(put_links){\n"
" \n"
" if(put_links[0] != -1){\n"
" openNew(put_links[0].file,'mirror1');\n"
" }else if(put_links[1] != -1){\n"
" openNew(put_links[1].file,'mirror2');\n"
" }else if(put_links[2] != -1){\n"
" openNew(put_links[2].file,'mirror3');\n"
" }else if(put_links[3] != -1){\n"
" openNew(put_links[3].file,'mirror4');\n"
" }else if(put_links[4] != -1){\n"
" openNew(put_links[4].file,'mirror5');\n"
" }else{\n"
" alert(\"no source available. please try after sometime!!\");\n"
" }\n"
"}\n\n\n\n\n"
"function initializePlayer(links){\n"
" var put_links= [];\n"
" var opn = false;\n"
" var mirros = [];\n"
" var cn = 0;\n"
" var links = jQuery.parseJSON(links);\n"
" if(links.length!=0){\n"
" for (i = 0; i < links.length; ++i) {\n"
" var getLinks = links[i];\n"
" \n"
" if (getLinks.trim()) {\n"
" //console.log(getLinks);\n"
" \n"
" if (/gounlimited/i.test(getLinks)) {\n"
" var singleSrc={};\n"
" singleSrc.file=links[i];\n"
" singleSrc.label='gounlimited';\n"
" singleSrc.type='mp4';\n"
" }else if (/\\/vid\\//i.test(getLinks)) {\n"
" var singleSrc={};\n"
" singleSrc.file=links[i];\n"
" singleSrc.label='vid';\n"
" singleSrc.type='mp4';\n"
" }else if (/\\/vid1\\//i.test(getLinks)) {\n"
" var singleSrc={};\n"
" singleSrc.file=links[i];\n"
" singleSrc.label='vid1';\n"
" singleSrc.type='hls';\n"
" singleSrc.default=false;\n"
" }else if (/onlystream/i.test(getLinks)) {\n"
" var singleSrc={};\n"
" singleSrc.file=links[i];\n"
" singleSrc.label='onlystream';\n"
" singleSrc.type='mp4';\n"
" }else if (/vcstream/i.test(getLinks)) {\n"
" var singleSrc={};\n"
" singleSrc.file=links[i];\n"
" singleSrc.label='vcstream';\n"
" singleSrc.type='mp4';\n"
" }else if (/mightyupload/i.test(getLinks)) {\n"
" var singleSrc={};\n"
" singleSrc.file=links[i];\n"
" singleSrc.label='mightyupload';\n"
" singleSrc.type='mp4';\n"
" }else if (/upstream/i.test(getLinks)) {\n"
" var singleSrc={};\n"
" singleSrc.file=links[i];\n"
" singleSrc.label='upstream';\n"
" singleSrc.type='mp4';\n"
" }else if (/hqq.tv/i.test(getLinks)) {\n"
" var singleSrc={};\n"
" singleSrc.file=links[i];\n"
" singleSrc.label='hqqtv';\n"
" singleSrc.type='mp4';\n"
" }else if (/mightyupload/i.test(getLinks)) {\n"
" var singleSrc={};\n"
" singleSrc.file=links[i];\n"
" singleSrc.label='mightyupload';\n"
" singleSrc.type='mp4';\n"
" }else {\n"
" var singleSrc={};\n"
" singleSrc.file=links[i];\n"
" singleSrc.label='gl';\n"
" singleSrc.type='mp4';\n"
" \n"
" }\n"
" if(singleSrc == -1){\n"
" mirros[i+1] = -1;\n"
" put_links[cn] = -1; cn++;\n"
" }else{\n"
" put_links.push(singleSrc);\n"
" mirros[i+1] = cn; cn++;\n"
" }\n"
" \n"
" }else{\n"
" mirros[i+1] = -1;\n"
" put_links[cn] = -1; cn++;\n"
" }\n"
" \n"
" }\n"
" }\n"
" \n"
" \n"
" if(opn){\n"
" //openNew(opn,'mirror1');\n"
" }else{\n"
" initializLinks(put_links);\n"
" }\n"
"}\n\n"
"$(document).ready(function(){\n"
" $('.custom_loading_sign').hide();\n"
" // $('.adtimes').hide();\n"
" linksgeter();\n"
" \n"
" });\n"
" \n"
"function linksgeter(){\n\n"
" //$('.adtimes').show();\n"
" //$('.app-download').hide();\n"
" //$('.skipads').hide();\n"
" \n"
" // document.getElementById('timer').innerHTML = 00 + \":\" + 30;\n"
" /// startTimer();\n"
" \n"
" //$('.cantskip').hide();\n"
" //$('#`player1`').hide();\n"
" //$('#adshow').hide();\n"
" $('#openloadIframe').show();\n"
" $('.player_area').show();\n"
" //$('.alternativer').height($('.alternativer ul').height()); \n"
" $('.custom_loading_sign').show();\n"
" var tc = 'bXFXbW9hVnJZV0Nub2FXbHBKYVRubUNsb1dDWG5wU1dsbDVrbUtsa21XUm9ZNmVVcUpKZ21hYWVucTJhcGFhaHBXdGhZR05qWlo2aHA1dVdwYUdla3F1V3BGK1ZvSjlncUpxV1lKZXFmR0dYaVhTZGU1dWhtcFo1aTVwK2RIeXJlNXVobW45MWY1cCtkSHlkZTV1aG1uK0ZmNXArZEh5aGxJaURtb0dhZkdHV2RZdGhnS3R6WVlDcm1acCtkSHlYZTV1aG1vQ0ZlNnQvbTVsamdJV0RZNENiaDJXQWhYZXJnWFdIWW51YXFacVdlR3VqaklobW1vR2FlMlovcTROaGdJV1ptcGlDWGwxWW42R2ZsNWFmazY2dG1xV21vYVZyWVdDYW9xTmZwcWRob1o2U3E1YWtZSmVlbEphV2tLS2RrNnFYbzJDaG1xRnhwNXVWYjRpZWc2S0dkNWlzaXArcGZvS3NlMmFFZG9PZGxXV0xlbjU2YzZlQ2htRnJWNU9tcHFDaW5aT3FiNStoclE9PQ';\n"
" $.ajax({ \n"
" type: \"POST\", url: \"https://123moviesplayer.com/decoding_v3.php\", \n"
" headers: { 'x-token': _tsd_tsd_ds(tc)},\n"
" data: {\n"
" 'tokenCode': tc,\n"
" \"_token\": \"lV3wAUeCfrSK80dAP3N2ge2pojJJrOcrjrWl2o9C\",\n"
" }, \n"
" success: function(put_links) {\n"
" $('.custom_loading_sign').hide();\n"
" initializePlayer(put_links);\n"
" } \n"
" });\n\n"
"}\n\n"
"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>\n\n\n\n"
"<style>\n"
"body,html{background-color: #000;}\n"
".player_area {bottom: 0 !important; left: 0; position: absolute; right: 0; top: 0; }\n"
".jwplayer.jw-flag-aspect-mode {height: 100% !important; }\n"
".jwplayer#player, body .jw-error {height: 100% !important; width: 100% !important; }\n"
".jw-icon.jw-icon-tooltip.jw-icon-cc.jw-reset.jw-hidden {display: inline-block !important; }\n"
"</style>\n\n\n\n\n"
"<!-- upload custome subtitles -->\n"
"<script data-cfasync=\"false\" src=\"https://123moviesplayer.com/dsPlayer/dropzone.js\"></script>\n\n\n\n\n\n\n\n\n\n\n"
"<script data-cfasync=\"false\">\n"
"$(\"<div class='alternativer'></div>\").appendTo($(\"body\"));\n"
"$(\".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>');\n\n"
"if($(\"iframe\").length==0) {\n"
" $(\".alternativer ul\").fadeIn()\n"
"}else $(\".alternativer\").css( { right:4,top:16 });\n\n"
"$(\".alternativer span\").click(function(){\n"
" $(\".alternativer ul\").fadeToggle()\n"
"}\n"
");\n"
"$(\".vjs-tech\").click(function() {\n"
" $('.alternativer ul').hide();\n"
"}\n"
");\n"
"$(\".vjs-poster\").click(function() {\n"
" $('.alternativer ul').hide();\n"
"}\n"
");\n"
"$('.alternativer ul li').click(function() {\n"
" $(\"*\").removeClass(\"select-hold\");\n"
" $(this).addClass('select-hold')\n"
"}\n"
");\n"
"function changeSource(sourceIndex){\n"
" var currentmovieHerf='https://123moviesplayer.com/show/the-good-doctor/03-13?src='+sourceIndex;\n"
" window.location.replace(currentmovieHerf); return false;\n"
"}\n\n"
"$(document).ready(function(){\n"
" //$('.alternativer').height($('.alternativer ul').height()); \n"
"});\n"
"</script>\n"
"<style>\n"
".alternativer ul li:hover, .alternativer ul li.select-hold {color: red; }\n"
".alternativer {max-height: 160px; position: absolute; right: 15px; bottom: 225px; width: 110px; z-index: 999999 !important; }\n"
".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; }\n"
".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; }\n"
".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%; }\n"
".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%; }\n"
".vjs-control-bar{z-index: 99999999999999999999;}\n"
"</style>\n"
" \n"
" <!-- Histats.com START (aync)-->\n"
"<script type=\"text/javascript\">var _Hasync= _Hasync|| [];\n"
"_Hasync.push(['Histats.start', '1,2793971,4,0,0,0,00010000']);\n"
"_Hasync.push(['Histats.fasi', '1']);\n"
"_Hasync.push(['Histats.track_hits', '']);\n"
"(function() {\n"
"var hs = document.createElement('script'); hs.type = 'text/javascript'; hs.async = true;\n"
"hs.src = ('//s10.histats.com/js15_as.js');\n"
"(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(hs);\n"
"})();</script> \n\n\n"
" <!-- Global site tag (gtag.js) - Google Analytics -->\n"
"<script async src=\"https://www.googletagmanager.com/gtag/js?id=UA-153655914-1\"></script>\n"
"<script>\n"
" window.dataLayer = window.dataLayer || [];\n"
" function gtag(){dataLayer.push(arguments);}\n"
" gtag('js', new Date());\n\n"
" gtag('config', 'UA-153655914-1');\n"
"</script>\n\n"
" \n\n\n\n"
"</body>\n"
"</html>")
matches = re.finditer(regex, test_str, re.MULTILINE)
for matchNum, match in enumerate(matches, start=1):
print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
for groupNum in range(0, len(match.groups())):
groupNum = groupNum + 1
print ("Group {groupNum} found at {start}-{end}: {group}".format(groupNum = groupNum, start = match.start(groupNum), end = match.end(groupNum), group = match.group(groupNum)))
# Note: for Python 2.7 compatibility, use ur"" to prefix the regex and u"" to prefix the test string and substitution.
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 Python, please visit: https://docs.python.org/3/library/re.html