4shared soap api based grabber with search by extension !

Started on the old forum in February 2013 · view the original in the archive · old links redirect here

37 replies · 9,938 views · started 13 years ago · 1 min read

TL;DR · summary of 37 replies
  • The fix for the 4shared API issue was found to be using the REST API, but no code approach or solution was provided.
  • Users reported issues with direct downloads due to changes in the API and encountered HTTP 403 Forbidden errors.
  • A user suggested adding a file ID parameter to display seconds left, but this did not solve the problem of getting the direct download link.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

19 participants
gendhenk Newbie · 7 posts #21

just_m3. wrote:

<?php
######################
## forged on gowap.ro#
######################

require_once'config.php';
require_once'functions.php';

$formeruri='http://www.4shared.com/mp3/'.$_GET['id'].'/'.$_GET['mod'].'.html';

# get direct download link
$client = new SoapClient("http://api.4shared.com/servlet/services/DesktopApp?wsdl");

$dlid = $client->getDirectLink(LOGIN,PASSWORD,$formeruri);
$id = $client->decodeLink(LOGIN,PASSWORD,$formeruri);
$info = $client->getFileInfo(LOGIN,PASSWORD,$id);

$regx=array('|\[(.*?)]|i','|\((.*?)\)|i','|www(.*?)$|i');
     
$nume_fisier=preg_replace($regx,'',utf8_format($info->name));

/// check if 302 and switch $url to header location 
/// otherwise use $dlid former url got from api
$head = array_change_key_case(get_headers($dlid, TRUE));
/// switch here
if(!empty($head['location'])){$dlid=$head['location'];} 
## if the $url is file location we force to get 200 ok 
## the $url location from header must also return 200 ok
$status=get_headers($dlid);

echo $status[0]."    "; 

if($status[0]=="HTTP/1.1 200 OK") {

echo' <a href="'.htmlspecialchars($dlid).'">'.$nume_fisier.' ['.format_bytes($info->size).'] </a><br/>';

}

/*
## we use else statement if header is not 200 ok 
## this works if they modify the header other than 302 or 200
## it will work fine but you will not be able to stop the user 
## for beeing redirected if the file doesn't exist anymore .

## uncomment if you want to use it !

else {
echo' <a href="'.htmlspecialchars($dlid).'">'.$nume_fisier.' ['.format_bytes($info->size).'] </a><br/>';
}
*/

## comment this line if you want to use the upper one !
else {
echo"<h1>This file is not available !</h1>";
}

?>

thank this script work bro..

icedroplet1987 Senior · 258 posts #22

just_m3. wrote: I wroted this script as much easier to understand as i could , as i posted before this require soap client installed on server side .

This should be easy to read through even for a newbie.

thats why serious users get irritated.. coz they (newbies) ask for even DOTS 🙁 anyways, coding-talk always rocks:)

n you too man @ just_m3

Kampret Newbie · 2 posts #23

nice work brother

good job brother

shijilt1234 Junior · 10 posts #24

Fisierul nu este disponibil reincarca pagina !

Fisierul nu este disponibil reincarca pagina !

Why this ? when trying to download a file ?

gammz Junior · 24 posts #25

shijilt1234 wrote: Fisierul nu este disponibil reincarca pagina !

Why this ? when trying to download a file ?

its work for me.. 😳 look Posted by just_m3. you can try that script... 😳

yar Newbie · 1 posts #26

download.php script does not work

download.php script does not work. share the finished bro

gammz Junior · 24 posts #27

yar wrote: download.php script does not work

download.php script does not work. share the finished bro

scripts are given just_m3 still works well

<?php 
###################### 
## forged on gowap.ro# 
###################### 

require_once'config.php'; 
require_once'functions.php'; 

$formeruri='http://www.4shared.com/mp3/'.$_GET['id'].'/'.$_GET['mod'].'.html'; 

# get direct download link 
$client = new SoapClient("http://api.4shared.com/servlet/services/DesktopApp?wsdl"); 

$dlid = $client->getDirectLink(LOGIN,PASSWORD,$formeruri); 
$id = $client->decodeLink(LOGIN,PASSWORD,$formeruri); 
$info = $client->getFileInfo(LOGIN,PASSWORD,$id); 

$regx=array('|\[(.*?)]|i','|\((.*?)\)|i','|www(.*?)$|i'); 
      
$nume_fisier=preg_replace($regx,'',utf8_format($info->name)); 

/// check if 302 and switch $url to header location  
/// otherwise use $dlid former url got from api 
$head = array_change_key_case(get_headers($dlid, TRUE)); 
/// switch here 
if(!empty($head['location'])){$dlid=$head['location'];}  
## if the $url is file location we force to get 200 ok  
## the $url location from header must also return 200 ok 
$status=get_headers($dlid); 

echo $status[0]."    ";  

if($status[0]=="HTTP/1.1 200 OK") { 

echo' <a href="'.htmlspecialchars($dlid).'">'.$nume_fisier.' ['.format_bytes($info->size).'] </a><br/>'; 

} 

/* 
## we use else statement if header is not 200 ok  
## this works if they modify the header other than 302 or 200 
## it will work fine but you will not be able to stop the user  
## for beeing redirected if the file doesn't exist anymore . 

## uncomment if you want to use it ! 

else { 
echo' <a href="'.htmlspecialchars($dlid).'">'.$nume_fisier.' ['.format_bytes($info->size).'] </a><br/>'; 
} 
*/ 

## comment this line if you want to use the upper one ! 
else { 
echo"<h1>This file is not available !</h1>"; 
} 

?>

for demo: http://gruls.tk/dldl.php?id=h7ZMNvYB masih bisa broooo... 😁

just_m3. Developer · 199 posts #28

Just to let you know ...

It seems that 4shared is changing some things on their api , they are having major issues with "shared" files , and i think their api will require new settings such as an app id or something , there are too many grabbers based on the api they shared , also the new api url is pointing at

https://api.4shared.com/jax3/DesktopApp?wsdl

previous was

http://api.4shared.com/servlet/services/DesktopApp?wsdl

, we need to wait untill everything gets "finished" , you can change your api link to the new one .

I'm posting this because few days ago i saw some message complaining about the forbiden message which the api returns .

This is ten percent luck, twenty percent skill Fifteen percent concentrated power of will Five percent pleasure, fifty percent pain 😂And a hundred percent reason to remember the name!

Djnadeem Newbie · 3 posts #30

If any one extract sid, dsid, tsid from file id then it may be work..

Freddynic159 Junior · 43 posts #32

I found the javascript that displays the count of 20 seconds.

you just have to add the file ID "fid"... for example:

[**http://www.4shared.com/mobile.root/pageDownload1/includes/secondsLeft.jsp?secondsLeft=0&fid=HjdajDQA**](http://www.4shared.com/mobile.root/pageDownload1/includes/secondsLeft.jsp?secondsLeft=0&fid=HjdajDQA)

I tried to make a grabber but it is impossible.

direct link has this structure, for example:

http://dc123.4shared.com/download/fileID/fileName?tsid=xxxxxxxxxx&lgfp=8000

but do not know how to get the download center "dc123" and "tsid".

razib Developer · 132 posts #33

damn.... its not working anymore!

🦸 Buying mobile traffic, PM me with your traffic details

shijilt1234 Junior · 10 posts #36

It is not working now ... says

"HTTP/1.1 403 Forbidden

This file is not available !"

Please upload a fixed script.

shijilt1234 Junior · 10 posts #37

It is not working now ... says

This file is not available

Please upload a fixed script.

shijilt1234 Junior · 10 posts #38

It is not working now ... says this file is not available ....

Please upload a fixed script.

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close