function my_header_add_to_cart_fragment( $fragments ) {
ob_start();
$count = WC()->cart->cart_contents_count;
if ( $count > 0 ) {
?>
<span class="cart-contents-count"><?php echo esc_html( $count ); ?></span>
<?php
}
?></a><?php
$fragments['a.cart-contents'] = ob_get_clean();
return $fragments;
}
add_filter( 'woocommerce_add_to_cart_fragments', 'my_header_add_to_cart_fragment' );
import http.client
import urllib.parse
conn = http.client.HTTPConnection('www.xx.xx')
conn.request('GET', '/get/140426640')
resp = conn.getresponse()
h_url = str(resp.getheader('Location'))
file_name = h_url.split('/')[-1]
file_ext = file_name[-4:]
tr_file_name = file_name[:-4]
print(urllib.parse.unquote(tr_file_name, 'utf-8')+file_ext)