Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # regex for use with newlist
- $exclude = $null
- #$exclude = 'vidzi'
- #$exclude = 'gorillavid'
- #$include = 'vodlocker'
- if ($exclude) { Write-Warning "Sites Being Excluded!: $exclude" }
- $sites = @(
- 'http://thewatchseries.to'
- 'http://watchseries.lt'
- 'http://watchseriestv.to'
- 'http://watchseries.ph'
- 'http://watchseries.ag'
- 'http://watchtvseries.se'
- )
- $list = @(
- 'gorillavid'
- #'filenuke' # mostly file not found
- #'daclips' # mostly file not found
- #'realvid'
- 'played'
- #'movpod' # mostly file not found
- 'vidzi' # half HD?
- #'allmyvideos' # mostly 1kb vids "wrong ip"
- 'vodu' # HD
- 'vodlocker' # HD
- 'watchfreeinhd' # HD
- )
- function gj { Get-Job | select id, name, state | ft -a }
- function sj ($id='*') { Get-Job $id | Stop-Job; gj }
- function rj { Get-Job | ? state -notmatch 'run' | Remove-Job; gj }
- function Remove-InvalidFileNameChars {
- param (
- [Parameter(ValueFromPipeline=$true)]
- [String]$Name,
- [switch]$IncludeSpace
- )
- if ($IncludeSpace) {
- [RegEx]::Replace($Name, "[{0}]" -f ([RegEx]::Escape([String][System.IO.Path]::GetInvalidFileNameChars())), '')
- } else {
- [RegEx]::Replace($Name, "[{0}]" -f ([RegEx]::Escape(-join [System.IO.Path]::GetInvalidFileNameChars())), '')
- }
- }
- $x = 0
- function searchsite ($term) {
- $titles = @()
- Write-Host "$($sites[$x])/search/$($term.Replace(' ','%20'))"
- $titles += (iwr "$($sites[$x])/search/$($term.Replace(' ','%20'))").links | select @{n='title';e={$_.title -replace 'watch serie '}}, href | ? {$_.title -and $_.href -match '\/serie\/'} | select -u *
- if ($titles) {
- for ($z=0; $z -lt $titles.count; $z++) {
- Write-Host "$($z+1) $($titles[$z].title)"
- }
- $titles
- }
- }
- $selection = -1
- while ($selection -lt 0 -or $selection -gt (@($titles).Count - 1)) {
- $term = ''
- if (!$term) {$term = Read-Host 'Search'}
- if (!$term) {continue}
- Write-Host ''
- $titles = ''
- $titles = searchsite $term
- if (!$titles) {continue}
- Write-Host ''
- try{ $selection = [int](Read-Host 'Show number') - 1 }catch{}
- Write-Host ''
- }
- $site = $($sites[$x]) + $titles[$selection].href
- Write-Host "Site: $site"
- $base = $site -replace '(http://[^\/]+).*', '$1'
- $show = $titles[$selection].title
- $show = Remove-InvalidFileNameChars $show
- function regexs {
- $regseason = Read-Host 'Season regex?'
- if ($regseason) {
- $regepisode = Read-Host 'Episode regex?'
- if (!$regepisode) {
- $regepisode = '\d\d?'
- }
- } else {
- $regseason = '\d\d?'
- $regepisode = '\d\d?'
- }
- $regseason
- $regepisode
- }
- function geteps ($regseason, $regepisode) {
- $episodes = (iwr $site).links.href | ? {$_ -match "_s$regseason`_e$regepisode\.html"} | select -u | sort | % {"$base$_"}
- $episodes | sort {$se = $_ -replace '.*_s([0-9][0-9]?)_.*', '$1';if ($se.Length -eq 1) {$se -replace '(.*)', '0$1'}else{$se}}, {$ep = $_ -replace '.*_e([0-9][0-9]?)\..*', '$1';if ($ep.Length -eq 1) {$ep -replace '(.*)', '0$1'}else{$ep}}
- }
- $cont = ''
- do {
- $ans = regexs
- $episodes = geteps $ans[0] $ans[1]
- Write-Host 'Episode List:'
- $episodes | % {Write-Host $_}
- $cont = Read-Host 'Continue?'
- } while ($cont -eq 'n')
- Write-Host ''
- function getinfo ($episode) {
- Write-Host "Episode: $episode"
- $name = (split-path $episode -leaf) -replace '\..*' -replace '_', ' '
- $season = $name -replace '.*s(\d\d?).*', 'S$1'
- if ($season.Length -eq 2) {$season = $season -replace 's(.*)', 'S0$1'}
- $number = $name -replace '.*e(\d\d?)$', 'E$1'
- if ($number.Length -eq 2) {$number = $number -replace 'e(.*)', 'E0$1'}
- $title = ((iwr $episode).ParsedHtml.title -replace '^.*episode \d\d? -(.*)- watch.*', '$1').Trim()
- $title = $title -replace '\s?online - watchseries\s?|\s?watch online .* season \d{1,2} episode \d{1,2} -\s?|\s?watch series\s?'
- $name = "$show $season$number" + $(if ($title) {" $title"})
- $name = Remove-InvalidFileNameChars $name
- $folder = "$show $season"
- @($name, $season, $number, $folder)
- }
- #ps iexplore -ea 0 | stop-process -ea 0
- foreach ($episode in $episodes) {
- $array = getinfo $episode
- $name = $array[0]
- $season = $array[1]
- $number = $array[2]
- $folder = $array[3]
- Write-Host "Name: $name" -fore yellow
- $newlist = (iwr $episode).links.href |? {$_ -match '^\/cale'} | select -Unique
- $newlist = $newlist | % { [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($_.Substring($_.IndexOf('=') + 1))) }
- if ($exclude) { $newlist = $newlist | ? {$_ -notmatch $exclude} }
- if ($include) { $newlist = $newlist | ? {$_ -match $include} }
- $i = 0
- $x = 1
- $file = $null
- while (!$file) {
- if ($i -eq @($newlist).count) {
- if ($x -eq $sites.Count) {
- Write-Host 'NOT FOUND' -fore red
- break
- }
- Write-Host 'NEXT SITE' -fore red
- $i = 0
- $episode = $sites[$x] + ($episode -replace '^.*(/episode.*)', '$1')
- $array = getinfo $episode
- $name = $array[0]
- $season = $array[1]
- $number = $array[2]
- $folder = $array[3]
- $base = $episode -replace '(http://[^\/]+).*', '$1'
- $x++
- $newlist = (iwr $episode).links.href |? {$_ -match '^\/cale'} | select -Unique
- $newlist = $newlist | % { [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($_.Substring($_.IndexOf('=') + 1))) }
- if ($exclude) { $newlist = $newlist | ? {$_ -notmatch $exclude} }
- if ($include) { $newlist = $newlist | ? {$_ -match $include} }
- }
- $ie = $null
- $prov = $null
- $external2 = $null
- $external2 = @($newlist)[$i]
- while (!$external2) {
- if ($i -eq $newlist.count) { break }
- $prov = $newlist[$i]
- try{
- $external1 = (iwr $episode).RawContent -split "`n" | ? {$_ -match "html.*$prov"} | % {$base + ($_ -replace '^.*href="|" class.*$')} <#| sort -desc#> | select -f 1
- $external2 = if ($external1) { (iwr $external1).Links.href | ? {$_ -match $prov} }
- if (!$external2) { $external2 = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($external1.Substring($external1.IndexOf('=') + 1))) }
- }catch{}
- $i++
- } if (!$external2) { continue }
- $prov = $external2 | % { $_.substring(7).substring(0, $_.substring(7).indexof('/'))}
- $i++
- Write-Host External: $external2
- try {
- $file = .\youtube-dl.exe $external2 -g 2>&1
- if (@($file).count -ne 1) { $file = $null }
- } catch {
- $file = $null
- }
- try { [System.Net.WebRequest]::Create($file).getresponse().statuscode | Out-Null } catch { $file = $null }
- if (!$file) { continue }
- } if (!$file) { continue }
- $ext = $file.substring($file.LastIndexOf('.')) -replace '\?.*$'
- Write-Host "Link: $file"
- $dest = "c:\temp\vid\$show\$folder\"
- if (!(Test-Path $dest)) { mkdir $dest | out-null }
- Write-Host $dest$name$ext
- if (!(Test-Path $dest$name$ext)) {
- Start-Job -Name "$name $prov" -ScriptBlock {param($f, $d, $n, $e, $p) iwr $f -OutFile $d$n$e; Write-Host "$n $p"} -ArgumentList $file, $dest, $name, $ext, $prov | Out-Null
- Write-Host 'DOWNLOADING' -ForegroundColor green
- } else {
- Write-Host 'ALREADY EXISTS' -ForegroundColor Yellow
- }
- Write-Host ''
- #Read-Host 'Press Enter to continue'
- #iwr $file -OutFile $dest$name$ext; write-host "$name $prov"
- }
- sleep 5
- while (1) {
- write-host $(gj | ft -a | out-string)
- if (!((get-job).state -match 'run')) {
- Read-Host 'Press Enter to continue'
- break
- }
- sleep 60
- }
- # Get-Job | ? state -match 'comp' | Remove-Job
Add Comment
Please, Sign In to add comment