RefreshCapcha

Author Topic: Trying to write v2 script for BakaBT  (Read 8686 times)

Offline CuF

  • Sr. Member
  • ****
  • Posts: 330
  • Karma: +40/-0
    • View Profile
Trying to write v2 script for BakaBT
« on: January 10, 2013, 08:27:09 am »
I have no idea what is up with this one.
It looks simple, but neither a standard login nor special login works when you try to search.
It says 'Advanced browsing is not available for non-members.'

Is this a BakaBT crazy thing or an incompatibility with BC v2?

Offline chip!

  • Bad Ass
  • Administrator
  • Unstoppable
  • *****
  • Posts: 2301
  • Karma: +629/-6
    • View Profile
Re: Trying to write v2 script for BakaBT
« Reply #1 on: January 10, 2013, 02:11:55 pm »
not sure really.. but attached here I have started the script, and it seems to login and search (i did not work on any of the result parsing code... everything there can be deleted)

let me know if that helps?
  -  https://convivea.com  -   And...  boom goes the dynamite.

Offline CuF

  • Sr. Member
  • ****
  • Posts: 330
  • Karma: +40/-0
    • View Profile
Re: Trying to write v2 script for BakaBT
« Reply #2 on: January 10, 2013, 03:08:34 pm »
Thanks.  Looks like it was sensitive to my using www. when I didn't need to.

Offline CuF

  • Sr. Member
  • ****
  • Posts: 330
  • Karma: +40/-0
    • View Profile
Re: Trying to write v2 script for BakaBT
« Reply #3 on: January 11, 2013, 08:05:36 am »
One more thing.  This is still one of those sites where the download link isn't in the search results.

The old trick was something like:
k=p(http://btjunkie.org/auto_download?do=download&id=)
7=save(k)

Is there a way to do that in v2?

Offline Bovski

  • Head Cider Tester
  • Hero Member
  • *****
  • Posts: 665
  • Karma: +189/-0
  • High Five Me
    • View Profile
    • Warez The Index
Re: Trying to write v2 script for BakaBT
« Reply #4 on: January 11, 2013, 09:45:00 am »
Well there is a [code2] section in v2 so the second page can be downloaded to grab the link.
Code: [Select]
[script]
name=bakabt.me
source=bakabt.me
author=chip
modified=Bovski 2013/01/12
pwd=1
version=2

[home]
1=http://bakabt.me

[profiles]
all=/browse.php?only=0&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&reorder=1&q=%SEARCH%

[login]
login=http://bakabt.me/login.php
form=username=%USER%&password=%PASS%
failed=<form method="post" action="login.php">
failed2=/login.php?return

[code1]
x=findh(@i,@data,`<div class="pager">`,`</tr></thead><tbody`,`>`,)
z=find(x,@data,`</tbody></table></div>`)
@data=crop(@data,x,z)
@data=vacuum(@data)
@data=replace(@data,`'`,``)
@data=replace(@data,`&amp;`,`&`)
@data=replace(@data,`<strong>`,``)
@r=split(@data,`</tr>`)

start
@q=split(@r,`</td>`,2)
t=array(q,1)
x=find(@i,t,`href=`)
$page=extract(x,t,`"`,`"`,@home)
$name=extract(x,t,`title="`,`"`)
$torrent=code($page,2)
$date=array(q,3)
$size=array(q,4)
t=array(q,5)
y=find(@i,t,`</a>`)
x=findrev(y,t,`>`)
$seeds=extract(x,t,`>`,`</a>`)
y=+(3)
y=find(y,t,`</a>`)
x=findrev(y,t,`>`)
$leeches=extract(x,t,`>`,`</a>`)
aloop
[/code1]

[code2]
x=find(@i,@data,`download_link`,`href=`)
$torrent=extract(x,@data,`"`,`"`,@home)
[/code2]

This is done when you attempt to download the torrent
Code: [Select]
$torrent=code($page,2)$page is downloaded and stored in @data then the [code2][/code2] section is run to generate the $torrent link
« Last Edit: January 11, 2013, 09:54:56 am by Bovski »

Offline CuF

  • Sr. Member
  • ****
  • Posts: 330
  • Karma: +40/-0
    • View Profile
Re: Trying to write v2 script for BakaBT
« Reply #5 on: January 11, 2013, 11:59:13 am »
Really slick.  Is that a fully working script for BakaBT or just an example?
I had everything else written except the $torrent.

Off my own topic, but I'm having trouble with HDBits now.  I know accounts for that are pretty rare, but I can't get the v1 login method to work, and special fails as well.  I'm not sure what I'm doing wrong.

Edit: No, looks like that script won't properly handle the 'Alternative versions'.
Stealing your [code2] though.

Edit2: Seriously, what the heck.  Now my BakaBT login isn't working again.
Edit3: Now logon is working but script is broken.  Some others that worked now produce incomplete results.
Was there a code update?
« Last Edit: January 11, 2013, 12:21:30 pm by CuF »

Offline CuF

  • Sr. Member
  • ****
  • Posts: 330
  • Karma: +40/-0
    • View Profile
Re: Trying to write v2 script for BakaBT
« Reply #6 on: January 11, 2013, 12:34:24 pm »
Okay, some of that is sorted.  For some reason my client kept resetting back to 'Audio' searches.
Here is my BakaBT script.  I'll post it on the regular script thread later... I have several more coming.
Code: [Select]
[script]
name=BakaBT.me
source=BakaBT
author=CuF, Bovski
modified=2013/01/11 by CuF
version=2
pwd=1

[home]
1=http://bakabt.me

[profiles]
all=/browse.php?only=0&hentai=1&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&reorder=1&q=%SEARCH%
video=/browse.php?only=0&hentai=1&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&c1=1&c2=1&c5=1&c6=1&c8=1&reorder=1&q=%SEARCH%
audio=/browse.php?only=0&hentai=1&incomplete=1&lossless=1&hd=1&multiaudio=1&bonus=1&c3=1&reorder=1&q=%SEARCH%

[login]
login=http://bakabt.me/login.php
form=username=%USER%&password=%PASS%&returnto=/search.php
failed=<form method="post" action="login.php">
failed2=/login.php?return

[code1]
x=findh(x,@data,`<tbody>`)
z=findh(x,@data,`</tbody>`)
@data=crop(@data,x,z)
@data=vacuum(@data)
@data=replace(@data,`<span class="highlight">`,``)
@data=replace(@data,`</span>`,``)
@data=replace(@data,`<tr class="torrent_alt alt0">`,`</td>`)
@data=replace(@data,`<tr class="torrent_alt alt1">`,`</td>`)
@r=split(@data,`</tr>`)

start
@q=split(@r,`</td>`)
t=array(@q,0)
@i=find(@i,t,`Alternative versions:`)
if (@i!0) then
loop
end if
t=array(@q,1)
@i=find(@i,t,`Alternative versions:`)
if (@i!0) then
loop
end if
@i=find(@i,t,`href`)
$page=extract(@i,t,`"`,`"`,`http://www.bakabt.me`)
$name=extract(@i,t,`>`,`<`)
$date=array(@q,3)
$size=array(@q,4)
t=array(@q,5)
@i=find(@i,t,`href`)
$seeds=extract(@i,t,`>`,`<`)
@i=find(@i,t,`href`)
$leeches=extract(@i,t,`>`,`<`)
$torrent=code($page,2)
aloop
[/code1]

[code2]
x=find(@i,@data,`download_link`,`href=`)
$torrent=extract(x,@data,`"`,`"`,@home)
[/code2]

Offline Bovski

  • Head Cider Tester
  • Hero Member
  • *****
  • Posts: 665
  • Karma: +189/-0
  • High Five Me
    • View Profile
    • Warez The Index
Re: Trying to write v2 script for BakaBT
« Reply #7 on: January 11, 2013, 12:50:50 pm »
Well the script I Posted is working well sort of.

Offline CuF

  • Sr. Member
  • ****
  • Posts: 330
  • Karma: +40/-0
    • View Profile
Re: Trying to write v2 script for BakaBT
« Reply #8 on: January 12, 2013, 02:57:05 am »
Yes, your script does work.

I just had noticed the weird formatting for the 'alternative versions' and spent some time faffing about to get those to come up too.
It's a weird thing.  They'll only have one listing for any item, and all other encodings are just footnotes.

Offline chip!

  • Bad Ass
  • Administrator
  • Unstoppable
  • *****
  • Posts: 2301
  • Karma: +629/-6
    • View Profile
Re: Trying to write v2 script for BakaBT
« Reply #9 on: January 15, 2013, 02:06:43 pm »
Yes, your script does work.

I just had noticed the weird formatting for the 'alternative versions' and spent some time faffing about to get those to come up too.
It's a weird thing.  They'll only have one listing for any item, and all other encodings are just footnotes.

i just fixed a really weird cookies bug that I found while testing this..  it was logining and searching, but then the cookies would get messed up while trying to download because there was a "|" character in the cookie which broke how Bit Che stored and parsed parameters from one function to another (major pain, but i just re-wrote everything to completely avoid that).
  -  https://convivea.com  -   And...  boom goes the dynamite.