Last active
December 25, 2023 09:09
-
-
Save codenoid/3edc9c048206cf7fb2ce90216e3e025a to your computer and use it in GitHub Desktop.
s.id Shortlink Generator Public API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl 'https://s.id/api/public/link/shorten' -H 'User-Agent: Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'X-Requested-With: XMLHttpRequest' -H 'Origin: https://s.id' -H 'Connection: keep-alive' -H 'Referer: https://s.id/' --data 'url=https%3A%2F%2Fne.com' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:http/http.dart' as http; | |
void main() async { | |
var headers = { | |
'User-Agent': 'Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0', | |
'Accept': '*/*', | |
'Accept-Language': 'en-US,en;q=0.5', | |
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', | |
'X-Requested-With': 'XMLHttpRequest', | |
'Origin': 'https://s.id', | |
'Connection': 'keep-alive', | |
'Referer': 'https://s.id/', | |
'Accept-Encoding': 'gzip', | |
}; | |
var data = 'url=https%3A%2F%2Fne.com'; | |
var res = await http.post('https://s.id/api/public/link/shorten', headers: headers, body: data); | |
if (res.statusCode != 200) throw Exception('post error: statusCode= ${res.statusCode}'); | |
print(res.body); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net/http" | |
) | |
func main() { | |
client := &http.Client{} | |
var data = []byte(`{url=https%3A%2F%2Fne.com}`) | |
req, err := http.NewRequest("POST", "https://s.id/api/public/link/shorten", data) | |
if err != nil { | |
log.Fatal(err) | |
} | |
req.Header.Set("User-Agent", "Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0") | |
req.Header.Set("Accept", "*/*") | |
req.Header.Set("Accept-Language", "en-US,en;q=0.5") | |
req.Header.Set("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8") | |
req.Header.Set("X-Requested-With", "XMLHttpRequest") | |
req.Header.Set("Origin", "https://s.id") | |
req.Header.Set("Connection", "keep-alive") | |
req.Header.Set("Referer", "https://s.id/") | |
resp, err := client.Do(req) | |
if err != nil { | |
log.Fatal(err) | |
} | |
bodyText, err := ioutil.ReadAll(resp.Body) | |
if err != nil { | |
log.Fatal(err) | |
} | |
fmt.Printf("%s\n", bodyText) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
var headers = { | |
'User-Agent': 'Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0', | |
'Accept': '*/*', | |
'Accept-Language': 'en-US,en;q=0.5', | |
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', | |
'X-Requested-With': 'XMLHttpRequest', | |
'Origin': 'https://s.id', | |
'Connection': 'keep-alive', | |
'Referer': 'https://s.id/' | |
}; | |
var dataString = 'url=https%3A%2F%2Fne.com'; | |
var options = { | |
url: 'https://s.id/api/public/link/shorten', | |
method: 'POST', | |
headers: headers, | |
body: dataString | |
}; | |
function callback(error, response, body) { | |
if (!error && response.statusCode == 200) { | |
console.log(body); | |
} | |
} | |
request(options, callback); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include('vendor/rmccue/requests/library/Requests.php'); | |
Requests::register_autoloader(); | |
$headers = array( | |
'User-Agent' => 'Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0', | |
'Accept' => '*/*', | |
'Accept-Language' => 'en-US,en;q=0.5', | |
'Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8', | |
'X-Requested-With' => 'XMLHttpRequest', | |
'Origin' => 'https://s.id', | |
'Connection' => 'keep-alive', | |
'Referer' => 'https://s.id/' | |
); | |
$data = array( | |
'url' => 'https://ne.com' | |
); | |
$response = Requests::post('https://s.id/api/public/link/shorten', $headers, $data); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
headers = { | |
'User-Agent': 'Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0', | |
'Accept': '*/*', | |
'Accept-Language': 'en-US,en;q=0.5', | |
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', | |
'X-Requested-With': 'XMLHttpRequest', | |
'Origin': 'https://s.id', | |
'Connection': 'keep-alive', | |
'Referer': 'https://s.id/', | |
} | |
data = { | |
'url': 'https://ne.com' | |
} | |
response = requests.post('https://s.id/api/public/link/shorten', headers=headers, data=data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate reqwest; | |
use reqwest::headers::*; | |
fn main() -> Result<(), reqwest::Error> { | |
let mut headers = HeaderMap::new(); | |
headers.insert(USER_AGENT, "Chrome/62.0 (BSD x86_64; rv:71.0) Gecko/20100101 Firefox/71.0".parse().unwrap()); | |
headers.insert(ACCEPT, "*/*".parse().unwrap()); | |
headers.insert(ACCEPT_LANGUAGE, "en-US,en;q=0.5".parse().unwrap()); | |
headers.insert(CONTENT_TYPE, "application/x-www-form-urlencoded; charset=UTF-8".parse().unwrap()); | |
headers.insert(X_REQUESTED_WITH, "XMLHttpRequest".parse().unwrap()); | |
headers.insert(ORIGIN, "https://s.id".parse().unwrap()); | |
headers.insert(CONNECTION, "keep-alive".parse().unwrap()); | |
headers.insert(REFERER, "https://s.id/".parse().unwrap()); | |
let res = reqwest::Client::new() | |
.post("https://s.id/api/public/link/shorten") | |
.headers(headers) | |
.body("url=https%3A%2F%2Fne.com") | |
.send()? | |
.text()?; | |
println!("{}", res); | |
Ok(()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment