Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pyodbc
class BlacktagPipeline(object):
import scrapy
class Blacktag(scrapy.Spider):
name = 'events'
start_urls = [
'https://blacktag.com.br/'
]
custom_settings = {
'DOWNLOAD_DELAY': 1.5,
'FEED_EXPORT_ENCODING':'utf-8'
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*int mdc(int n1, int n2){
int resto = n1 % n2;
while(resto!=0){
n1 = n2;
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int calc_mdc(int n1, int n2, int n3){
int div, mdc = 1;
for(div = 2; div <= n1; div ++){
if((n1 % div == 0) && (n2 % div == 0) && (n3 % div == 0))
mdc = div;
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int mdc(int n1, int n2){
int resto = n1 % n2;
while(resto!=0){
n1 = n2;
n2 = resto;
import requests
url = 'http://www.submarino.com.br/'
r = requests.get(url)
cookie = r.cookies.get_dict()
#print(cookie)
url = 'http://www.submarino.com.br/busca/?conteudo=notebook'
import requests
payload = {'action':'metadata-get',
'format':'html',
'imageUrl':'http://freevideolectures.com/blog/wp-content/uploads/2015/03/Big-data-free-courses.jpg'}
r = requests.post('http://metapicz.com/view.php', data=payload)
print(r.text)
import logging
import datetime
import os
#recupera a data atual e divide em ano e mês
data = datetime.date.today().strftime("%Y-%m")
ano, mes = data.split('-')
#suposta função onde tem um dicionário que converte data em número em mes escrito
#por exemplo: você passa o número 10 e a função retorna outubro
def teste(*args, **kwargs):
for key in kwargs.keys():
print(key)
for i in args:
print(i)
teste(nome="Thomas", sobrenome="William")
teste('1', '2', 'teste2', 'teste 4')
import requests
from bs4 import BeautifulSoup
#Aqui vamos capturar o html da página:
url = "https://news.netcraft.com"
response = requests.get(url)
#print(response.text)
#Pronto agora que temos o html, precisamos retirar o texto que nós interessa
#vi que o começo de toda notícia utiliza uma div com uma class="entry-content"