Skip to content

Instantly share code, notes, and snippets.

@inconvergent
Created February 2, 2018 09:59
Show Gist options
  • Save inconvergent/a85cef5c0748a48a42a6f07f6f3f6cad to your computer and use it in GitHub Desktop.
Save inconvergent/a85cef5c0748a48a42a6f07f6f3f6cad to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
# crude template for generating pinterest DMCA takedown request emails.
# send to: copyright@pinterest.com
#example csv file:
#new,2018/01/25,https://no.pinterest.com/pin/489696159457745571/,url,http://url.com
#new,2018/01/25,https://no.pinterest.com/pin/34832597103507119/,desc,old
from jinja2 import Environment, DictLoader
from csv import reader
loader = DictLoader({'fuck.txt': '''
DMCA TAKE DOWN REQUEST
I request that the following list of Pinterest urls, with description be taken down:
{% for a in elements %} {% if a[0] == 'new'%}
PINTEREST URL: {{ a[2] }}
EXPLANATION:
{% if a[3] == 'url' %}The content can be seen at {{a[4]}} {% endif %}
{% if a[3] == 'desc' and a[4] == 'old' %}The content was publised on my Website (URL). But it is no longer online.{% endif %}
{% endif %}{% endfor %}
CONTACT INFO:
[Full contact info with email and phone number]
STATEMENTS:
"I hereby state that I have a good faith belief that the disputed use of the copyrighted material or reference or link to such material is not authorized by the copyright owner, its agent, or the law (e.g., as a fair use)."
"I hereby state that the information in this Notice is accurate and, under penalty of perjury, that I am the owner, or authorized to act on behalf of the owner, of the copyright or of an exclusive right under the copyright that is allegedly infringed.”
SIGNATURE:
[FULL NAME IN CAPS]
'''})
with open('data.csv') as f:
elements = reader(f)
env = Environment(loader=loader)
template = env.get_template('fuck.txt')
res = template.render(elements=elements)
print(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment