import requests
import time
def extract_articles(urls):
"""Extract content from multiple articles."""
articles = []
for url in urls:
response = requests.get(
"https://api.ujeebu.com/extract",
headers={"ApiKey": "YOUR_API_KEY"},
params={"url": url})
if response.status_code == 200:
data = response.json()
article = data["article"]
articles.append({
'url': url,
'title': article.get('title'),
'author': article.get('author'),
'pub_date': article.get('pub_date'),
'text': article.get('text'),
'language': article.get('language')
})
time.sleep(1) # Rate limiting
return articles
# Extract from multiple URLs
urls = [
"https://blog.example.com/article-1",
"https://blog.example.com/article-2",
"https://news.example.com/story"
]
articles = extract_articles(urls)
print(f"Extracted {len(articles)} articles")
const axios = require('axios');
async function extractArticles(urls) {
const articles = [];
for (const url of urls) {
const response = await axios.get('https://api.ujeebu.com/extract', {
headers: { 'ApiKey': 'YOUR_API_KEY' },
params: { url },
validateStatus: () => true
});
if (response.status === 200) {
const article = response.data.article;
articles.push({
url,
title: article.title,
author: article.author,
pub_date: article.pub_date,
text: article.text,
language: article.language
});
}
await new Promise(resolve => setTimeout(resolve, 1000)); // Rate limiting
}
return articles;
}
// Extract from multiple URLs
const urls = [
'https://blog.example.com/article-1',
'https://blog.example.com/article-2',
'https://news.example.com/story'
];
extractArticles(urls).then(articles => {
console.log(`Extracted ${articles.length} articles`);
});
from ujeebu_python import UjeebuClient
import time
uj = UjeebuClient(api_key="YOUR_API_KEY")
def extract_articles(urls):
"""Extract content from multiple articles."""
articles = []
for url in urls:
res = uj.extract(url=url)
data = res.json()
if "article" in data:
article = data["article"]
articles.append({
'url': url,
'title': article.get('title'),
'author': article.get('author'),
'pub_date': article.get('pub_date'),
'text': article.get('text'),
'language': article.get('language')
})
time.sleep(1) # Rate limiting
return articles
urls = [
"https://blog.example.com/article-1",
"https://blog.example.com/article-2",
"https://news.example.com/story"
]
articles = extract_articles(urls)
print(f"Extracted {len(articles)} articles")
const { UjeebuClient } = require('@ujeebu-org/ujeebu-sdk');
const client = new UjeebuClient("YOUR_API_KEY");
async function extractArticles(urls) {
const articles = [];
for (const url of urls) {
const res = await client.extract(url);
const data = res.data;
if (data.article) {
const article = data.article;
articles.push({
url,
title: article.title,
author: article.author,
pub_date: article.pub_date,
text: article.text,
language: article.language
});
}
await new Promise(resolve => setTimeout(resolve, 1000)); // Rate limiting
}
return articles;
}
const urls = [
'https://blog.example.com/article-1',
'https://blog.example.com/article-2',
'https://news.example.com/story'
];
extractArticles(urls).then(articles => {
console.log(`Extracted ${articles.length} articles`);
});
<?php
function extract_articles($urls) {
$articles = [];
foreach ($urls as $url) {
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.ujeebu.com/extract?' . http_build_query(['url' => $url]),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['ApiKey: YOUR_API_KEY'],
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpCode === 200) {
$data = json_decode($response, true);
$article = $data['article'];
$articles[] = [
'url' => $url,
'title' => $article['title'] ?? null,
'author' => $article['author'] ?? null,
'pub_date' => $article['pub_date'] ?? null,
'text' => $article['text'] ?? null,
'language' => $article['language'] ?? null,
];
}
sleep(1); // Rate limiting
}
return $articles;
}
// Extract from multiple URLs
$urls = [
'https://blog.example.com/article-1',
'https://blog.example.com/article-2',
'https://news.example.com/story',
];
$articles = extract_articles($urls);
echo "Extracted " . count($articles) . " articles\n";
package main
import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"time"
)
type Article struct {
Title string `json:"title"`
Author string `json:"author"`
PubDate string `json:"pub_date"`
Text string `json:"text"`
Language string `json:"language"`
}
func extractArticles(urls []string) []Article {
var articles []Article
for _, u := range urls {
endpoint := "https://api.ujeebu.com/extract?" + url.Values{"url": {u}}.Encode()
req, _ := http.NewRequest("GET", endpoint, nil)
req.Header.Set("ApiKey", "YOUR_API_KEY")
res, err := http.DefaultClient.Do(req)
if err != nil {
continue
}
body, _ := io.ReadAll(res.Body)
res.Body.Close()
if res.StatusCode == 200 {
var data struct {
Article Article `json:"article"`
}
json.Unmarshal(body, &data)
articles = append(articles, data.Article)
}
time.Sleep(1 * time.Second) // Rate limiting
}
return articles
}
func main() {
// Extract from multiple URLs
urls := []string{
"https://blog.example.com/article-1",
"https://blog.example.com/article-2",
"https://news.example.com/story",
}
articles := extractArticles(urls)
fmt.Printf("Extracted %d articles\n", len(articles))
}
package main
import (
"fmt"
"log"
"time"
"github.com/ujeebu/ujeebu-go"
)
func main() {
client, err := ujeebu.NewClient("YOUR_API_KEY")
if err != nil {
log.Fatal(err)
}
urls := []string{
"https://blog.example.com/article-1",
"https://blog.example.com/article-2",
"https://news.example.com/story",
}
var articles []*ujeebu.Article
for _, u := range urls {
article, _, err := client.Extract(ujeebu.ExtractParams{URL: u})
if err != nil {
continue
}
articles = append(articles, article)
time.Sleep(1 * time.Second) // Rate limiting
}
fmt.Printf("Extracted %d articles\n", len(articles))
}