Is there any good tool to automatically edit AI generated articles in bulk?

I'd be interested
Python:
class InternalLink():
    def __init__(self, api_url, username, password):
        self.api_url = api_url
        self.username = username
        self.password = password

    def fetch_all_posts(self):
        posts = []
        page = 1
        while True:
            response = requests.get(
                f"{self.api_url}/posts", params={"page": page}, auth=HTTPBasicAuth(self.username, self.password))

            # Handle 400 error specifically
            if response.status_code == 400:
                print(f"400 Bad Request on page {page}. Exiting pagination.")
                break

            response.raise_for_status()  # Raise other errors
            data = response.json()
            if not data:
                break
            posts.extend(data)
            page += 1
        return posts

    def fetch_latest_posts(self):
        response = requests.get(
            f"{self.api_url}/posts",
            params={"per_page": 10, "orderby": "date",
                    "order": "desc"},  # Fetch the latest 20 posts
            auth=HTTPBasicAuth(self.username, self.password)
        )

        # Handle 400 error specifically
        if response.status_code == 400:
            print(f"400 Bad Request. Exiting request.")
            return []

        response.raise_for_status()  # Raise other errors
        data = response.json()
        return data

    def fetch_posts_by_ids(self, post_ids):
        posts = []
        for post_id in post_ids:
            response = requests.get(
                f"{self.api_url}/posts/{post_id}",
                auth=HTTPBasicAuth(self.username, self.password)
            )

            # Handle 400 error specifically
            if response.status_code == 400:
                print(
                    f"400 Bad Request for post ID {post_id}. Skipping this post.")
                continue

            response.raise_for_status()  # Raise other errors
            posts.append(response.json())

        return posts

    def update_post(self, post_id, modified_content):
        response = requests.post(
            f"{self.api_url}/posts/{post_id}",
            auth=HTTPBasicAuth(self.username, self.password),
            json={'content': modified_content}
        )
        response.raise_for_status()
        return response.json()

    def modify_posts_with_internal_links(self, ids):
        # posts = self.fetch_latest_posts()
        # posts = fetch_all_posts()
        posts = self.fetch_posts_by_ids(ids)
        link_structure = create_link_structure(posts)

        for post in posts:
            post_id = post['id']
            original_content = post['content']['rendered']

            modified_content = add_internal_links_to_article(
                original_content, link_structure, post['link'])

            if modified_content != original_content:
                self.update_post(post_id, modified_content)
                print(f"Updated post {post['link']}")
            else:
                print(f"No changes needed for post {post['link']}")

This is a class for fetching, modifying then updating posts content. Modifying logic may differ.
 
i wrote a script for that, but had to exploit a public API, So i have unlimited access but can also face jail time LOOL
Exploiting a public API means they didn't do security right.

IMHO, that's on them.
 
Back
Top
AdBlock Detected

We get it, advertisements are annoying!

Sure, ad-blocking software does a great job at blocking ads, but it also blocks useful features and essential functions on BlackHatWorld and other forums. These functions are unrelated to ads, such as internal links and images. For the best site experience please disable your AdBlocker.

I've Disabled AdBlock