ó
 vRc           @   s¤   d  d l  Z  d  d l Z d  d l Z d  d l Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z e d k r  e ƒ  n  d S(   iÿÿÿÿNc         C   s)   t  |  d ƒ } | j ƒ  } | j ƒ  | S(   Nt   rU(   t   opent   readt   close(   t   patht   ft   data(    (    s?   F:\python\my stuff\pastebin downloader\download\scanpastebin.pyt   readfile   s    
c         C   s   t  j  ƒ  j |  ƒ } | S(   N(   t
   HTMLParsert   unescape(   t   htmlt   deescaped_string(    (    s?   F:\python\my stuff\pastebin downloader\download\scanpastebin.pyt   deescape   s    c         C   sq   t  j  |  ƒ } d } xU | j ƒ  D]G } t | t j ƒ rM | | j ƒ  7} q" | j d k r" | d 7} q" q" W| S(   Nt    t   brs   
(   t   BeautifulSoupt   recursiveChildGeneratort
   isinstancet   typest   StringTypest   stript   name(   R
   t   elementt   textt   elem(    (    s?   F:\python\my stuff\pastebin downloader\download\scanpastebin.pyt   replace_with_newlines    s    c         C   sM   t  j  |  ƒ } | j d i d d 6ƒ } | j } t | ƒ d k sI t ‚ | S(   Nt   textareat
   paste_codet   idi   (   R   t   findR   t   lent   AssertionError(   R
   t   soupt   text_area_elementt   text_area_text(    (    s?   F:\python\my stuff\pastebin downloader\download\scanpastebin.pyt   extract_raw_paste_text,   s
    	c         C   s8   t  j  |  ƒ } | j d i d d 6ƒ } t | ƒ } | S(   Nt   divR   t   class(   R   R   t   unicode(   R
   R    t   display_area_elementt   display_area_html(    (    s?   F:\python\my stuff\pastebin downloader\download\scanpastebin.pyt   extract_display_area?   s    c         C   s!   t  |  ƒ } | GHt | ƒ } | S(   N(   R)   R   (   R
   R(   t   display_area_text(    (    s?   F:\python\my stuff\pastebin downloader\download\scanpastebin.pyt   extract_paste_from_displayF   s    c         C   s#   d } | |  k r d GHt  St Sd  S(   Ns   #1 paste tool since 2002s   File was pastebin html!(   t   Truet   False(   R
   t   slogan_string(    (    s?   F:\python\my stuff\pastebin downloader\download\scanpastebin.pyt   check_if_pastebin_htmlU   s
    c         C   s#   d } | |  k r d GHt  St Sd  S(   Ns:   This is a private paste. If you created this paste, pleases   Paste is private!(   R,   R-   (   R
   t   private_paste_warning_string(    (    s?   F:\python\my stuff\pastebin downloader\download\scanpastebin.pyt   check_if_private_paste_   s
    c         C   s‘   t  |  ƒ r d Sy8 t |  ƒ } t | ƒ } t | ƒ d k sC t ‚ | SWnB t k
 rŒ t |  ƒ } t | ƒ } t | ƒ d k sˆ t ‚ | SXd  S(   NR   i   (   R1   R#   R   R   R   R+   (   R
   t   raw_paste_textt
   paste_text(    (    s?   F:\python\my stuff\pastebin downloader\download\scanpastebin.pyt
   grab_pastei   s    c          C   s&   t  d ƒ }  t |  ƒ GHt |  ƒ GHd  S(   Ns&   tests/pastebin/Untitled.2HtWWAps.1.htm(   R   R4   R/   (   R
   (    (    s?   F:\python\my stuff\pastebin downloader\download\scanpastebin.pyt   mainy   s    t   __main__(   t   reR   R   R   R   R   R   R#   R)   R+   R/   R1   R4   R5   t   __name__(    (    (    s?   F:\python\my stuff\pastebin downloader\download\scanpastebin.pyt   <module>   s   							
	
		