writeProxyPoolToFile
void proxyServerPool.writeProxyPoolToFile ( String path )
Description
Write list of proxies after invalid proxies have been removed.
Parameters
- path File path to where the file should be written, as a string.
Return Values
Returns void.
Change Log
Version | Description |
---|---|
4.5 | Available for all editions. |
Examples
Write Good Proxies to File
import com.screenscraper.util.*;
// Create a new ProxyServerPool object.
proxyServerPool = new ProxyServerPool();
// Must be set on the session before other calls are made
session.setProxyServerPool(proxyServerPool);
// This tells the pool to populate itself from a file
proxyServerPool.populateFromFile( "proxies.txt" );
// Validate proxies up to 25 proxies at a time.
proxyServerPool.setNumProxiesToValidateConcurrently( 25 );
// Set timout interval
proxyServerPool.filter( 7 );
// Once filtering is done, it's often helpful to write the good
// set of proxies out to a file. That way you may not have to
// filter again the next time.
proxyServerPool.writeProxyPoolToFile( "good_proxies.txt" );
// Create a new ProxyServerPool object.
proxyServerPool = new ProxyServerPool();
// Must be set on the session before other calls are made
session.setProxyServerPool(proxyServerPool);
// This tells the pool to populate itself from a file
proxyServerPool.populateFromFile( "proxies.txt" );
// Validate proxies up to 25 proxies at a time.
proxyServerPool.setNumProxiesToValidateConcurrently( 25 );
// Set timout interval
proxyServerPool.filter( 7 );
// Once filtering is done, it's often helpful to write the good
// set of proxies out to a file. That way you may not have to
// filter again the next time.
proxyServerPool.writeProxyPoolToFile( "good_proxies.txt" );
scraper on 07/16/2010 at 5:21 pm
- Printer-friendly version
- Login or register to post comments