Auto S.E , my new tool. 05-04-2017, 09:52 PM
#1
About
When trying to get items off companys I had a pretty simple tactic.
1.Go on amazon and search for something like bluetooth speakers.
2.Contact all companys that showed up with some generic shit like "its broken".
3.See what replys I got.
This works ok , but its tedious and slow work. So I decided to automate the process!
So lets go through the stages of how this works.
Stage One
We need a list of products , for this we need to grab all pages off sites like amazon. For this I made my own scripting language. Lets examine it...
Line one
html_extractall_with_manu(<h2 data-attribute=",",by </span><span class="a-size-small a-color-secondary">,</span>)
this is calling the function html_extractall_with_manu , this extracts all products with the manufacture name from a websites html (in this case amazon). There are 4 params
1.
<h2 data-attribute=",
This is always to the left of the html of our products name.
2. "
this quote is to the right of our products name.
3. by </span><span class="a-size-small a-color-secondary"
This string is to the right of out html next to the company name
4.
This string is to the left of our html , next to the company name
</span>
Line Two
exit_if_not_found(class="pagnNext")
This tells the script to exit if class="pagnNext" is not in the html (another words theres no "load next page" button.
Line Three
3. increase_url_param(page,1,2)
This tells the script to increase the paraameter in the url for "page" , by 1 and to start from page 2 if the paramater "page" is not inside the url  already.
The result is this:
![[Image: PBlJ617.png]](http://i.imgur.com/PBlJ617.png)
Now we have a script we can use it on any url we wish for amazon. So stage one is done , we have a list of products to work with..
Stage two
Now we need a excuse for that its easy these are bluetooth speakers , so ill just say some generic shit like "its hissing".
![[Image: y1ozS6Q.png]](http://i.imgur.com/y1ozS6Q.png)
%itemname% will be replaces automatically in our email to this company with the name of the item we are tryint to s.e.
Setting up a job
Now we need to start a job , to do that is easy.
![[Image: ZNthqeq.png]](http://i.imgur.com/ZNthqeq.png)
Now usually I have this script running on a vps server and my server would now kick in and process everything for us , but for this thread I set the script up on my own pc so I can run the python script from here to show you it functioning...
![[Image: 6GFVHkL.png]](http://i.imgur.com/6GFVHkL.png)
So what just happened?
Well first the site searched google using a alg to find the producs home page. It used some logic to decide on the best link. Then it used a alg to find the "contact us page" or support page ect. Finally it extracted all email addresses and found the best one to contact (e.g it would contact support@somesite.co.uk before support@somesite.com for me ect). Now the email address , product home page and item name are blacklisted so we never email the same place twice. The script continues this process for all products.
Notes:
The php site is just a test html template I downloaded and wrapped my script around , its far from final.
The code is still very much work in progress ,but it functions.
When trying to get items off companys I had a pretty simple tactic.
1.Go on amazon and search for something like bluetooth speakers.
2.Contact all companys that showed up with some generic shit like "its broken".
3.See what replys I got.
This works ok , but its tedious and slow work. So I decided to automate the process!
So lets go through the stages of how this works.
Stage One
We need a list of products , for this we need to grab all pages off sites like amazon. For this I made my own scripting language. Lets examine it...
Code:
html_extractall_with_manu(<h2 data-attribute=",",by </span><span class="a-size-small a-color-secondary">,</span>)
exit_if_not_found(class="pagnNext")
increase_url_param(page,1,2)Line one
html_extractall_with_manu(<h2 data-attribute=",",by </span><span class="a-size-small a-color-secondary">,</span>)
this is calling the function html_extractall_with_manu , this extracts all products with the manufacture name from a websites html (in this case amazon). There are 4 params
1.
<h2 data-attribute=",
This is always to the left of the html of our products name.
2. "
this quote is to the right of our products name.
3. by </span><span class="a-size-small a-color-secondary"
This string is to the right of out html next to the company name
4.
This string is to the left of our html , next to the company name
</span>
Line Two
exit_if_not_found(class="pagnNext")
This tells the script to exit if class="pagnNext" is not in the html (another words theres no "load next page" button.
Line Three
3. increase_url_param(page,1,2)
This tells the script to increase the paraameter in the url for "page" , by 1 and to start from page 2 if the paramater "page" is not inside the url  already.
The result is this:
![[Image: PBlJ617.png]](http://i.imgur.com/PBlJ617.png)
Now we have a script we can use it on any url we wish for amazon. So stage one is done , we have a list of products to work with..
Stage two
Now we need a excuse for that its easy these are bluetooth speakers , so ill just say some generic shit like "its hissing".
![[Image: y1ozS6Q.png]](http://i.imgur.com/y1ozS6Q.png)
%itemname% will be replaces automatically in our email to this company with the name of the item we are tryint to s.e.
Setting up a job
Now we need to start a job , to do that is easy.
![[Image: ZNthqeq.png]](http://i.imgur.com/ZNthqeq.png)
Now usually I have this script running on a vps server and my server would now kick in and process everything for us , but for this thread I set the script up on my own pc so I can run the python script from here to show you it functioning...
![[Image: 6GFVHkL.png]](http://i.imgur.com/6GFVHkL.png)
So what just happened?
Well first the site searched google using a alg to find the producs home page. It used some logic to decide on the best link. Then it used a alg to find the "contact us page" or support page ect. Finally it extracted all email addresses and found the best one to contact (e.g it would contact support@somesite.co.uk before support@somesite.com for me ect). Now the email address , product home page and item name are blacklisted so we never email the same place twice. The script continues this process for all products.
Notes:
The php site is just a test html template I downloaded and wrapped my script around , its far from final.
The code is still very much work in progress ,but it functions.
(This post was last modified: 05-04-2017, 09:55 PM by Darkbyte.)
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)








![[Image: oAqtc2l.png]](https://i.imgur.com/oAqtc2l.png)
.








