Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6691911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:48:23+00:00 2026-05-26T05:48:23+00:00

This is a bit of a an odd question but I’ll make it out

  • 0

This is a bit of a an odd question but I’ll make it out the best I can. I’m in the works on writing a script with the use of proxies, but I ran in to a problem automating part of it, which sucks as it’s the last part of everything that I need then I’m done.

Example: Lets say I have a list of 200 or so proxies in this format stored in a .txt file:

110.138.183.60:8080
110.138.20.67:8080
110.138.208.116:8008
110.138.237.80:3128
110.138.248.17:8080
110.138.248.78:80
110.139.182.234:8080
ect ect ect...

First part of this script is I need to randomize them, so just mix them all up in different orders but making sure they all end up on one line each as they are now.

Second part after randomizing them, and then taking the first 99 of the randomized proxies and moving them in to one line in this format, ignoring any proxies after the 99th. (Separated by |, without one at the beginning or end. )

110.138.183.60:8080|110.138.208.116:8008|110.138.237.80:3128|110.138.248.17:8080|110.138.248.78:80|110.139.182.234:8080|110.138.20.67:8080

Third part is I need this new line of proxies to edit and replace a line in a file. The line would currently look something like this:

user_pref("extensions.proxytool.http_proxies", "129.59.26.40:8909|87.106.143.132:3128|85.17.121.205:9090|88.85.125.78:8080|80.82.150.82:8080");

Where you see the proxies in that line, I need to replace them with the new batch of proxies we just created.

End Result looking something like this:

...
user_pref("extensions.proxytool.clear_cookies_on_new_window", true);
user_pref("extensions.proxytool.firstrun", false);
user_pref("extensions.proxytool.http_proxies", "110.138.183.60:8080|110.138.208.116:8008|110.138.237.80:3128|110.138.248.17:8080|110.138.248.78:80|110.139.182.234:8080|110.138.20.67:8080");
user_pref("extensions.proxytool.proxy_type", "http");
user_pref("extensions.proxytool.referer", "default");
...

I wouldn’t ask so much if I wasn’t desperate, I’m literally on the last hair of my project before completing it. Any help is greatly appreciated! Thanks in advance!

EDIT: Script complete. Credit goes to Zack Bloom for the help! I got a little lazy with how the python script works, instead I have created a default prefs file with an empty proxy line, so outside the python script, a default prefs file is copied over in to my program, and then the python script does it’s magic and replaces the line “proxies go here” with the newly compiled list. Thanks again Zack!

from random import sample

with open("C:/Users/USERACCOUNT/test/today.txt") as proxy_file:
    proxies = [proxy.strip() for proxy in proxy_file.readlines()]

    proxies = sample(proxies, min(len(proxies), 99))

    proxy_str = "|".join(proxies)

import fileinput
import sys

def replaceAll(file,searchExp,replaceExp):
    for line in fileinput.input(file, inplace=1):
        if searchExp in line:
            line = line.replace(searchExp,replaceExp)
        sys.stdout.write(line)

replaceAll('C:/Users/USERACCOUNT/test/prefs.js','proxiesgohere',proxy_str)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:48:24+00:00Added an answer on May 26, 2026 at 5:48 am

    Creating the list is simple enough:

    from random import sample
    
    with open("proxy_list.txt") as proxy_file:
        proxies = [proxy.strip() for proxy in proxy_file.readlines()]
    
        proxies = sample(proxies, min(len(proxies), 99))
    
        proxy_str = "|".join(proxies)
    

    Then you must use a templating language (there’s one in the std lib: http://docs.python.org/library/string.html#template-strings) to create your output file with the string included.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This might be a little bit odd question, but Im trying to figure out
This might sound a bit of an odd question but I know what I
This is a bit odd, but is it possible to use an NSCalendar (or
Bit of an odd question but I'm hoping someone can point me in the
This may be a stupid question but I can't seem to figure this out.
This is a bit of an odd question and more of a though experiment
this may seem a little odd, but it would make for a convenient way
This is a bit odd perhaps, but wondering if it is possible to achieve
A bit odd maybe, but how can I move the cursor using code in
This may be a bit of an odd question, and what I have in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.