Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This script scrapes a web streaming site, presents the show list, and then streams the content directly from the back-end CDN.
- # It's currently hard-set to "Adventure Time".
- $player = 'C:\Program Files (x86)\VideoLAN\VLC\vlc.exe'
- $TargetShow = "rick-and-morty"
- $genre = "cartoons"
- #$Genres = @("anime","cartoons","movies","ova")
- #foreach ($genre in $genres) {
- #$genre = "anime"
- #$content = invoke-webrequest "http://www.watchcartoononline.com/$genre-list/"
- #$ShowRegex = [regex]$( ".*(http.*\/" + $genre + ".*)`"" ).tostring()
- #$($content.AllElements | ?{$_.tagname -eq "LI"} | select -expand innerhtml | select-string -pattern $ShowRegex).matches.groups.captures.value |?{$_ -notmatch "href"}}
- $MainUrl = "http://www.watchcartoononline.com/$genre/$targetShow"
- [System.Reflection.Assembly]::LoadWithPartialName("System.web")
- [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
- [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
- function GetList($MainUrl){
- Write-host "Grabbing first WebRequest: $mainurl"
- $content = invoke-webrequest $MainUrl -TimeoutSec 11 -ErrorAction Stop
- $URLList = $($content.AllElements | ?{$_.tagname -eq "LI"} | select -expand innerhtml | select-string -pattern ".*(http.*)`"").matches.groups.captures.value | ?{$_ -match ("^http.*" + $targetshow + ".*")} | select -unique
- return $URLList
- }
- $UrlList = GetList $MainUrl
- $showList = $urllist -replace "(http:\/\/.*\/)|($targetshow-)",""
- out-file .\showlist.txt -InputObject $showlist -force
- start .\showlist.txt
- function WatchShow ($url, [switch]$watchnow, $ShowName) {
- write-host $url
- $content = invoke-webrequest $url -TimeoutSec 9
- $PlayerURL = $($content.content | select-string -pattern ".*(http:\/\/.*flv).*").matches.groups[1].value
- $content = invoke-webrequest $PlayerURL -body "fuck_you=&confirm=Click+Here+to+Watch+Free%21%21" -method post
- $RawFileURL = $($content.content | select-string -pattern ".*file.*(http.*flv).*").matches.groups[1].value
- $DecodedFileUrl = [system.web.httputility]::UrlDecode($RawFileUrl)
- $EncodedFileUrl = $([system.uri]$DecodedFileUrl).absoluteURI
- $filepathy = "`"$pwd\$TargetShow`-$ShowName.flv`""
- write-host "Wgetting: $encodedfileurl"
- $WgetArguments = @{argumentlist = "/k wget.exe -c `"$encodedfileurl`" -O $FilePathy"}
- if (-not $watchnow) {$WgetArguments += @{wait=$true}}
- if (-not (test-path $filepathy)) {start-process "cmd.exe" @WGetarguments}
- if ($watchnow){
- sleep 10
- start-process $player -argumentlist "`"$filepathy`""
- }
- }
- function downloadall($urllist) {
- $urllist | %{watchShow "$_"}
- }
- function watchone($word) {
- $ShowUrl = "$($urllist -match "$word" | select -unique -first 1)"
- watchshow $ShowUrl -watchnow $word
- }
- function Return-DropDown {
- $Choice = $DropDown.SelectedItem.ToString()
- watchone $choice
- }
- Function DropDown($List){
- [array]$DropDownArray = $List
- $i=0;$DropDownArray |%{if ($_.length -gt $i) {$i = $_.length}}
- write-host $i
- $Form = New-Object System.Windows.Forms.Form
- $Form.width = ($i*8)
- $Form.height = 150
- $Form.Text = βWatchβ
- $DropDown = new-object System.Windows.Forms.ComboBox
- $DropDown.Location = new-object System.Drawing.Size(30,10)
- $DropDown.Size = new-object System.Drawing.Size(($i*6),$i)
- ForEach ($Item in $DropDownArray) {$DropDown.Items.Add($Item)}
- $Form.Controls.Add($DropDown) | out-null
- $DropDown2Array = @("Cartoons";"Anime";"Movies")
- $DropDown2 = new-object System.Windows.Forms.ComboBox
- $DropDown2.Location = new-object System.Drawing.Size(30,10)
- $DropDown2.Size = new-object System.Drawing.Size(($i*6),$i)
- ForEach ($Item in $DropDown2Array) {$DropDown2.Items.Add($Item)}
- $Form.Controls.Add($DropDown2) | out-null
- $DropDownLabel = new-object System.Windows.Forms.Label
- $DropDownLabel.Location = new-object System.Drawing.Size(10,10)
- $DropDownLabel.size = new-object System.Drawing.Size(100,20)
- $DropDownLabel.Text = $args
- $Form.Controls.Add($DropDownLabel)
- $Button = new-object System.Windows.Forms.Button
- $Button.Location = new-object System.Drawing.Size(100,50)
- $Button.Size = new-object System.Drawing.Size(100,20)
- $Button.Text = "OK"
- $Button.Add_Click({Return-DropDown})
- $form.Controls.Add($Button)
- $Form.Add_Shown({$Form.Activate()})
- $Form.ShowDialog()
- };
- dropdown $showlist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement